Quantcast
Viewing all articles
Browse latest Browse all 3636

Change datasource for xml and xsd in runtime

Hi

 

I've a report working with Xml and Xsd, for some reason, I've to create a new "instance" when calling the report, means, create new folder to save the three files: .rpt, .xml and .xsd.

 

The sample code as following:

            System.Data.DataSet reportData = new System.Data.DataSet();

            reportData.ReadXml(xmlFile);

            ReportDocument reportDoc = newReportDocument();

            reportDoc.Load(rptFile);

            reportDoc.DataSourceConnections[0].SetConnection(xsdFile, "", false);

            reportDoc.SetDataSource(reportData);

The report always uses the initial data (in report design) instead of the new datasource, but the DataSourceConnections updated.

 

Questions please:

 

 

    How to change the data source in runtime?

    How can I check the current data source?

 

PS.

  • Visual Studio 2012
  • Crystal Reports for .NET 12.0.2000.0
  • C#

 

Thanks,

Andrew Huang

 

Message was edited by: Ludek Uher


Viewing all articles
Browse latest Browse all 3636

Trending Articles