Here's the scenario: I have many different report files (*.rdl) and the user is able to select one from a web interface. This, in turn, loads a Report Viewer control (as an ASPX control).
My *.rdl files contain both Data Sources and Datasets in the definition (I checked the XML in Notepad just to be sure). The data source is an Oracle Stored Procedure. The report runs just fine if I run it inside Report Builder 3.
What I don't understand is how I can load the report file into the Report Viewer at runtime, and have it automatically use the Data Sources and Datasets that are defined inside the report definition.
try
{
Viewer.LocalReport.ReportPath = myLocalRDLPath; // Exists and is readable
var reader = new StringReader(File.ReadAllText(myLocalRDLPath));
Viewer.LocalReport.LoadReportDefinition(reader);
}
catch(Exception ex)
{
throw new Exception("Unable to open report definition file from server.", ex);
}
if (Viewer.LocalReport.DataSources.Count > 0)
{
// Never hits, DataSources is always empty, but
// a Data Source and a Dataset exist in the .rdl file.
}