on 04-07-2016 4:28 PM
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.
No reason to call the .refresh, that refreshes the report with the original data source which would cause the database connection error.
If I create a new report off the attached xml fiile it works fiine. Could be your original report does not match the xml file.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
I cannot attach RPT file type..
I try to share it to following link:
https://drive.google.com/folderview?id=0ByGrZWB8_pe5ZEJIcnAySVJ6RW8&usp=sharing
Your solution doesn't work for me..
ds.ReadXml("xxxxx\Reti1.xml")
rpt.SetDataSource(ds)
return the same error..
The solution works correctly only if Report.DataSource is connected to Database (ODBC) and not changed from application.
But I need to send data dynamically.. the use of XML I think is a correct solution.
In previous solution (VB6 and VB2008) I used TTX DataSource sending Recordset from VB application: rpt.SetDataSource(Recordset).. the solution worked correctly.
Thanks for reply
Thank you for the report....
My code works for your report also.... wanted to make sure you were not using the legacy XML driver.
Only thing I can think of as to the cause is something is broken on your PC.
Check your references and make sure they are all version 13.x.x.x. sometimes VS doesn't update them all. Check your app.config file and make sure you have this in it:
<startup useLegacyV2RuntimeActivationPolicy="true">
Don
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.