Skip to Content
Oct 05, 2012 at 06:29 AM

How to set ReportDocument.Database.Tables[idx].Location?



I am using crystal report inside visual studio 2010.

I have a DataSet that contains 5 tables. I serialize the dataset into a xml file, and I use the XML file as the crstal report database file in report design time.

Because Each time my application give the xml file a random name, so I need assign the file to crystal table. I tried the way as followed,

for (int idx = 0; idx < rptDoc.Database.Tables.Count; idx++)


rptDoc.Database.Tables[idx].Location = "c:\invoice1.xml"; // rptDoc is ReportDocument


This doesn't generate an error. But when it executes


it has error message:

"Cannot determine the queries necessary to get data for this report. Failed to retrieve data from the database."

If the xml file only contains one table then the report is OK.

How can I solve the problem?