Change Connection String dynamically through a report parameter
|Product||Progress® Telerik® Reporting|
Sometimes it is necessary to change dynamically the connection string of a report and/or data item.
The requirement can be achieved without writing additional code, directly in the report definition using dedicated report parameters. Here are the steps:
- In the report definition introduce a new Report Parameter (for example ConnectionStringParameter) - the connection string will be passed to the Report via this parameter.
Property path | Expression DataSource.ConnectionString | Parameters.ConnectionStringParameter.Value
The DataSource.ConnectionString property is not listed in the dropdown and must be typed manually.
The proposed approach cannot be used to modify the Connection String of Report Parameter -> AvailableValues -> DataSource as report parameters do not expose Bindings.
The same approach can be used to modify the SelectCommand Property of the SqlDataSource. The DataSource.SelectCommand should be set in the above code snippet in this case.