From: JB on
Hello Community

I am using C# and ASP.net .Net Framework 3.5 and an embedded
Crystal Report in the web application will be created from a Dataset.xsd
file
that I create programmatically on the fly .

When creating the Crystal Report rpt file using the "Database Expert" ,
under "Create New Connection, Database Files" it shows "NewDataSet" and
under it the default name "Table" after the appl creates the dataset.

Next I use the carat to move the table named "Table" over to the
"Selected Tables" pane and click "OK".

I can see the fields in the table within the Dataset so I move
the fields into the Details pane of Crystal Report .

After that I make sure I can see the xml file that is created on
the c: drive.

Now I save the file and run the application.

The problem is that only the first 2 rows from the Dataset/xml
file show up on the report.

The following is code for how the dataset and report is created:

Dataset:

myDataset = CreateDataset();
MyDataset.WriteXml(@"c:\myData.xml");


Report:

ReportDocument psReport = new ReportDocument();
string reportPath = Server.MapPath("myData.rpt");
psReport.Load(reportPath);
objReport.ReportLogin(psReport); Note: this line provides credentials

CrystalReportViewer1.ReportSource = psReport;
CrystalReportViewer1.DataBind();

Am I connecting the rpt file and Dataset correctly?
What can I do to make this report show all rows?
Do I have to delete the xml everytime the DataSet is created?

Thanks
Jeff

--
JB
From: Andy O'Neill on

>"JB" <JB(a)discussions.microsoft.com> wrote in message
>news:54AA3399-A2AB-4D0A-B442-9C7E1413E314(a)microsoft.com...

This code substitutes a datatable for the crystal report's datasource.
If you must have a dataset then DataTable dt = myDataset.Tables[0];

ReportDocument rd;
// Tricky bit here is to make the name of the datatable match what
the report expects
dt.TableName = "DataTable1";
rd = new ReportDocument();
rd.Load(Server.MapPath("Reports\\myReport.rpt"));
rd.SetDataSource(dt);

rd.Refresh();
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.RefreshReport();