cancel
Showing results for 
Search instead for 
Did you mean: 

Load XML File Into Report

Former Member
0 Kudos

We are attempting to load an XML file through the API into Crystal Reports 13.  We are using this code:

rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

          rptDoc.Load(@strTemplateLocation);

DataSet ds = new DataSet();

ds.ReadXmlSchema(@strXSDLocation);

ds.ReadXml(@strXMLLocation);

rptDoc.SetDataSource(ds);

try

{

    rptDoc.Export();

}

catch(Exception ex)

{

    ExceptionManager.InsertException(ex);

    throw ex;

}

When we execute this code we get "Failed to load database information"

The RPT was built using the same schema and XML file.

How best to use the API to load complex XML files that work in the designer using the XML and Web Services Connection?


Thanks,

Tom

Accepted Solutions (1)

Accepted Solutions (1)

former_member188030
Active Contributor
0 Kudos

I am assuming that the report is working fine from designer when you point it to the same XML file (which is you are using in your code.).

See below utility, which will wrtie the DB code for your report.

Run the EXE, load your report and generate the code.

Now use the generated code to develp a new app with your report, it will load the XML for your report.

http://search.sap.com/notes?id=0001553921&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64...

- Bhushan

Senior Engineer

SAP Active Global Support

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Getting started and moving ahead with Crystal Reports .NET applications.

Former Member
0 Kudos

The VS 2010 version crashes when I execute it.

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Alternatively see the KBA 1203980 - How to change the location of the .XSD and .XML files at runtime in a .NET application

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

This logic functions - thank you.  However, the performance is pretty bad (4-5 seconds per table so a couple of minutes).

I'm attaching a test project (change extension from txt to zip).  What can be done to make this work and maintain performance?


Thanks,

Tom