Feed Parameter to Connection String

2 posts, 0 answers
  1. Dana Cobb
    Dana Cobb avatar
    46 posts
    Member since:
    Mar 2007

    Posted 06 Mar 2015 Link to this post

    I wish to change the database the connection string is pointed to based upon a Reporting parameter. Is that possible? Or do I have to use the ChangeConnectionString class I found on another thread.

    Ideally, I'd like to be able to have a parameter called @dbid and have the connectionstring be:

    <ConnectionString Name="DynamicConnection" ConnectionString="Data Source=servername;Initial Catalog=@dbid;Integrated Security=True"
                                ProviderName="System.Data.SqlClient" />

    All within the designer. Is this possible?

  2. Nasko
    Nasko avatar
    944 posts

    Posted 11 Mar 2015 Link to this post

    Hello Dana Cobb,

    The ConnectionString property of the SqlDataSource component does not support expressions or report parameters. Thus, you will need to use the approach described in the Changing the connection string dynamically according to runtime data KB article.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top