Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error setting ReportDocument.SetDataSource with Dataset

I'm using Visual Basic 2015 (Visual Studio 2015 Professional) and SAP Crystal Report for Visual Studio SP16.

To send dynamically data from ADODB.Recordset to Report I'm setting ReportDocument.SetDataSource property with a Dataset, the same of the Report DataSource (generated with Dataset.WriteXML):

This solution work correctly in VS2008.

The cryRpt.SetDataSource  setting generate the following Error: Unable to load the database information


Attached Report DataSource Image and XML Dataset.

Thanks for help.

Immagine3.png (28526 B)
Reti1.xml (7315 B)
replied

It's C# but this works for me:

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

ds.ReadXml(@"D:\Atest\Bossu\Reti1.xml");

// as long as the field names match exactly Cr has no problems setting report to a DS.

try

{

    rpt.SetDataSource(ds.Tables[0]);

     // either one of  these work, if only 1 table in report next line will work also.

    //rpt.SetDataSource(ds);

}

catch (Exception ex)

{

    MessageBox.Show("ERROR: Schema Mismatch. Error reported by CR: " + ex.Message);

}

As long as the table name is the same it should not have a problem.

If you have multiple tables then it could be a problem, you would need to set the AliasName also.

Also used the Logon Method and that too works....

I would check your report for errors, bad formula that could be using a field that no longer exists is a known problem.

Don

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question