Crystal report with xml as datasource and export as pdf

Jun 23 2009 7:59 AM

Guys,
I have XML and its corresponding XSD file and its report file. All i want is to bind the XML data to the report and export the report as PDF. I am using Visual Studio 2003. The following is the code.
try

{
   DataSet dsXml =
new DataSet();
   dsXml.ReadXml(@"C:\Temp\CONSUMERWO_20000001.xml"); 
   ReportDocument rpt =
new ReportDocument();
   rpt.Load(@"C:\Temp\CONSUMERWO.rpt");
   rpt.SetDataSource(dsXml.Tables[0]); 
   rpt.ExportToDisk(ExportFormatType.PortableDocFormat, @"C:\Temp\" +   Guid.NewGuid().ToString() + ".pdf");
}
catch (Exception Ex)
{
   txtMessage.Text = "Exception: " + Ex.Message;
}

Error: Exception: This field name is not known.
Details: errorKind
Error in File C:\DOCUME~1\SENTHI~1.PRA\LOCALS~1\Temp\{CF274BB7-E0F0-40D4-AA9D-DC0AB7724FFE}.rpt:
Error in formula  <Serv>.
'WHILEREADINGRECORDS;
'

What could be the problem. Am I missing something. Am new to Crystal.
Thanks in Advance
SP

Answers (2)