0

How should I extract the following connection string and apply it to my Linq context? I know the Linq portion, but am weak with the System.Configuration section.

  <connectionStrings>
        <!-- Production

        <add name="Management_Report_Emailer.Properties.Settings.DWConnectionString"
            connectionString="Data Source=prodSQL01;Initial Catalog=DW;Integrated Security=True"
            providerName="System.Data.SqlClient" />-->


      <!-- QA-->

      <add name="Management_Report_Emailer.Properties.Settings.DWConnectionString"
            connectionString="Data Source=qaSQL01;Initial Catalog=DW;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>

2 Answers 2

2
ConfigurationManager.ConnectionStrings("Management_Report_Emailer.Properties.Settings.DWConnectionString").ConnectionString
Sign up to request clarification or add additional context in comments.

2 Comments

Works for me, just had to replace parens, with brackets. Thanks!
Yeah, I didn't see anything talking about VB/C# so I just put it in the VB way.
0
ConfigurationManager.ConnectionStrings["Management_Report_Emailer.Properties.Settings.DWConnectionString"].ConnectionString;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.