I have set up a SQLDataSource parameter for a report and can set its value at design time. I need to set the parameter value from a UI element at runtime. This is the code that I have (setting the TypeReportSource dynamically at runtime works fine, and I can query the report's parameter's collection without issue. However, once I update the parameter value, the report still uses the design-time value.
the value '999' is not passed into the query (I am using SQL Profiler to see the value passed in by the reporting framework). I see the value I set at design time.
// Specifying the assembly qualified name of the Report class for the TypeName of the report source<
br
>
ViewerReportSource = new TypeReportSource {TypeName = selectedReport.ReportType.AssemblyQualifiedName};<
br
><
br
>
// create instance of report
<
br
>var report = (Report)Activator.CreateInstance(selectedReport.ReportType);
<
br
><
br
>
// Set filters (datasource params)<
br
>
var ds = report.DataSource as SqlDataSource;<
br
>
ds.Parameters["@UserID"].Value = 999;
the value '999' is not passed into the query (I am using SQL Profiler to see the value passed in by the reporting framework). I see the value I set at design time.