Page 1 of 1

Sample for XMLDatabase

Posted: Tue Jan 08, 2013 2:18 pm
by tpontow
Hello,

is there a more complex sample for using XML as report datasource available? I would like to assign XML data and XSD schema file at runtime before rendering the report?

Thanks
Thorsten Pontow

Re: Sample for XMLDatabase

Posted: Wed Jan 09, 2013 8:08 am
by HighAley
Hello.

Here is a sample code how to use XML data:
DataSet demoDataSet = new DataSet();
demoDataSet.ReadXmlSchema(@"D:\Data.xsd");
demoDataSet.ReadXml(@"D:\Data.xml");

rep.Dictionary.Databases.Clear(); // Remove all Connections
rep.Dictionary.DataSources.Clear(); // Remove all Data Sources
rep.Dictionary.ImportXMLSchema(demoDataSet);
rep.RegData(demoDataSet);
rep.Dictionary.Synchronize() // This method could be use instead of ImportXMLSchema() method.
You should remove all Data Sources and Connections if there is any one in your report to prevent a naming collision.

Thank you.