I have an Active Reports 13 report defined using the rdlx format. The report also contains a number of sub-reports.
When defined in the report designer the data source is set to some test data, however, when the report is embedded in a WPF application we wish to update the location of the database pragmatically.
We have been able to update the data source for the main report, but it is not clear (to us!) how to update the data source for the sub-reports.
string report = _reportPath;
// checked the report file exists ...
if (File.Exists(report))
{
// create and setup the data source
// create an empty page report
GrapeCity.ActiveReports.PageReport def = new GrapeCity.ActiveReports.PageReport();
//load the report layout
def.Load(new System.IO.FileInfo(report));
//setup the dataset
GrapeCity.ActiveReports.PageReportModel.DataSource myDataSource = def.Report.DataSources[0];
def.Report.DataSources[0].ConnectionProperties.DataProvider = "OLEDB";
def.Report.DataSources[0].ConnectionProperties.ConnectString = @"RunData.mdb;provider=Microsoft.Jet.OLEDB.4.0;";
// loop through subreports and set the location of the run data database
// ????
reportViewer.LoadDocument(def.Document);
}
Does anyone have some pointers to how we should be writing the code at "????" above to also update the subreports?