Skip to Content
Former Member
Jan 11, 2017 at 04:39 PM

Crystal Reports - Exchange XML data source programmatically

809 Views Last edit Jan 11, 2017 at 04:39 PM 2 rev


I designed a report pointing to local XML and XSD files. Now, I want to process the .rpt file programmatically in a .NET 4.6.2 app by specifying a new XML data source. However, after I call SetDataSource and Refresh on the ReportDocument, the report object throws a CrystalDecisions.CrystalReports.Enging.DataSourceException when I call ExportToStream:

{"Fehler beim Laden der Datenbankinformationen.\rFehler in der Datei ExternalXMLReport 1856_6320_{0543C9E8-7559-44A9-BADE-1551F0E603BE}.rpt:\nFehler beim Laden der Datenbankinformationen"}

The corresponding code snippet looks like this:

var report = new ReportDocument();
DataSet reportData = new DataSet();
var pdfStream = report.ExportToStream(ExportFormatType.PortableDocFormat);

How can I avoid this exception?

The goal is to design reports with XML and XSD files locally with the Crystal Reports Designer Desktop Application and passing the latest data to the report at runtime.

I also tried setting the XSD file on the DataSet with no success.

Thanks for your help in advance.

Best Regards,