Setting SQL-parameters before rendering
Posted: Thu Dec 13, 2012 7:43 pm
Hello,
I'm trying to apply values to pre-defined SQL parameters in a report template before rendering the report using Stimulsoft.Net. My SQL query uses named parameters with the @-syntax, and the individual parameters are registered with the data source.
I've found the following entry in section 2.5 of the Reports.Net FAQ:
But I was unable to get any SQL-parameters set via this method to apply -- no changes were seen in the rendered report.
I was finally able to get this to work by creating a new report variable for each SQL-parameter, entering that report variable name into the definition of the SQL-parameter via the report designer, and then using code similar to the above (referring to the variable name, without the @-symbol used only for parameters) to set the report variable programmatically, which then sets the associated SQL-parameter. This is what I'm using for now.
Is there a way to do this directly, without creating a report variable for each SQL-parameter? Thanks in advance.
I'm trying to apply values to pre-defined SQL parameters in a report template before rendering the report using Stimulsoft.Net. My SQL query uses named parameters with the @-syntax, and the individual parameters are registered with the data source.
I've found the following entry in section 2.5 of the Reports.Net FAQ:
Code: Select all
report.Compile();
report["@customerid"] = 1;
I was finally able to get this to work by creating a new report variable for each SQL-parameter, entering that report variable name into the definition of the SQL-parameter via the report designer, and then using code similar to the above (referring to the variable name, without the @-symbol used only for parameters) to set the report variable programmatically, which then sets the associated SQL-parameter. This is what I'm using for now.
Is there a way to do this directly, without creating a report variable for each SQL-parameter? Thanks in advance.