New to Telerik Reporting? Download free 30-day trial

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:

  1. In the report definition introduce a new Report Parameter (for example ConnectionStringParameter) - the connection string will be passed to the Report via this parameter.
  2. In the Report or other Data item (Table, List, etc.) where the connection string is supposed to be changed dynamically introduce a new Binding as shown below:

    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.

See Also

Changing the connection string dynamically according to runtime data

In this article