Below is how I bind the DataSet to the crystal report:
DataSet dsRpt = grabData();
ReportDocument rptDoc = new ReportDocument();
rptDoc.SetDataSource(dsRpt);
The dsRpt has several DataTables which contains data to be displayed in the crystal report.
I added a sub-report in the crystal report, and I set the sub-report's datasource to a server.
But during runtime, the report will be used on different servers so I have to use the DataTable as the report's DataSource.
So here's the problem:
No matter how the `dsRpt` changed, the newly added sub-report's data isn't changed
(i.e. the datasource isn't correctly binded to the sub-report)
I tried the steps in below article to help troubleshoot: http://ift.tt/1AMBpRf
- Write the
dsRpt
to a xml file - Change the datasource of the sub-report to the xml file
- The datasource location is successfully updated
But if I save the subreport as a main report, the DataTable in dsRpt
is now correctly loaded to the report, so if I add a new subreport to main report, what I need to do to bind the DataSet's data to the subreport?
Aucun commentaire:
Enregistrer un commentaire