Question about Loading from XML
Hi everyone. I'm trying to load a report from an XML file, and I keep getting the below errors:
Here is my code:
//Create Dataset
DataSet EstimateDS = new DataSet();
EstimateDS.ReadXml(Environment.CurrentDirectory + "//EstimateSample3.xml");
FastReport.Report report = new FastReport.Report();
//Use if designing report
report.SetParameterValue("FullPathNameOfPictureFile", fullpathname);
report.RegisterData(EstimateDS, "Data");
report.GetDataSource("Data").Enabled = true;
report.Design(true);
At the report.GetDataSource("Data").Enabled = true; line, I am getting an error that "The object is not set to an instance of an object"
There is a Data parent node that holds all of my data.
If I save the xml to a file and attach it as a datasource manually through the report designer, it finds all of my data without an issue. So I'm not sure what I'm doing wrong here.
Thanks Again!
Here is my code:
//Create Dataset
DataSet EstimateDS = new DataSet();
EstimateDS.ReadXml(Environment.CurrentDirectory + "//EstimateSample3.xml");
FastReport.Report report = new FastReport.Report();
//Use if designing report
report.SetParameterValue("FullPathNameOfPictureFile", fullpathname);
report.RegisterData(EstimateDS, "Data");
report.GetDataSource("Data").Enabled = true;
report.Design(true);
At the report.GetDataSource("Data").Enabled = true; line, I am getting an error that "The object is not set to an instance of an object"
There is a Data parent node that holds all of my data.
If I save the xml to a file and attach it as a datasource manually through the report designer, it finds all of my data without an issue. So I'm not sure what I'm doing wrong here.
Thanks Again!
Comments
I changed my code to use this method of adding the DataSource instead and this works much better for XML.
foreach (DataSourceBase source in report.Dictionary.DataSources)
{
source.Enabled = true;
}
Thanks Again!
give me the same error if i use a code like this: