
vb.Net 2003 & Crystal Report data source = Dataset question
I am trying to develop a
Crystal Report using a ADO.Net DataSet. I
populated a dataset, and created the XML file using the
ds.WriteXmlSchema method. I created a new Crystal Report, adding the
XML file under More Data Sources in the Database Expert. The field
explorer listed the fields in the data set. I designed the report. I
then bind a populated ds to the report using Report.SetDataSource(ds).
I also pass the report 2 parameters. The report shows the parameters
but does not list the rows in the dataset.
I am using vb.Net 2003, Crystal Reports version 9.1.5000.0.
The code follows:
Dim sales As New SJ
Dim PFD As ParameterFieldDefinition
Dim PValues As ParameterValues
Dim Parm As ParameterDiscreteValue
With oRequest
.CommandType = CommandType.Text
.Command = "SELECT * FROM AcctHist" & _
" JOIN company ON AC_CompCode = Comp_Code" & _
" JOIN Cont ON AC_ContNo = CN_ContNo" & _
" WHERE AC_CompCode = '" & mCompCode & _
"' AND AC_YYMM = '" & mYYMM & "'"
" ORDER BY CN_CustCode, AC_ContNO, AC_RD, " &
_
"AC_SubType, AC_LiftNo"
.TableName = "AcctHist"
.TableFill = "Fill"
.Transactional = False
End With
ds = GetData.GetDS(oRequest)
Dim sss As Integer = ds.Tables(0).Rows.Count
'XmlFile.CreateXmlFile("SalesJournal.ds", ds)
PValues = New ParameterValues
PFD =
sales.DataDefinition.ParameterFields.Item("CompCode")
Parm = New ParameterDiscreteValue
Parm.Value = mCompCode
PValues.Add(Parm)
PFD.ApplyCurrentValues(PValues)
PFD =
sales.DataDefinition.ParameterFields.Item("YYMM")
Parm = New ParameterDiscreteValue
Parm.Value = mYYMM
PValues.Add(Parm)
PFD.ApplyCurrentValues(PValues)
sales.SetDataSource(ds)
CrystalReportViewer1.ReportSource = sales
sales.Close()
sales.Dispose()
The dataset has 33 rows. Any ideas on why the rows are not listed on
the report.