+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / How can I get the connection strings

How can I get the connection strings

3 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    05 Jan 2011
    Link to this post
    How can the a list of connection strings from sitefinitys DataConfig.config?

    I cant seem to get them from this collection
    ConfigurationManager.ConnectionStrings
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    05 Jan 2011
    Link to this post
    Hi Steve,

    Please try the code below

    var dataConfig = Config.Get<DataConfig>();
    var cs = dataConfig.ConnectionStrings;


    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. jason
    jason avatar
    3 posts
    Registered:
    04 May 2009
    27 May in reply to Ivan Dimitrov
    Link to this post

    What is the required reference for DataConfig? 

    The type or namespace name 'DataConfig' could not be found (are you missing a using directive or an assembly reference?)

     

    I want to access the Sitefinity database connection string from Data.Config.

    Or otherwise, how can I query the database directly from c#?

    Thanks.

3 posts, 0 answered