Save (Store) multiple Connection Strings in App.Config or Web.Config file

Last Reply on Nov 14, 2017 06:47 AM By kalpesh

Posted on Nov 14, 2017 05:54 AM

How we can set 2 or more connection string in app.config file in winforms? For single connectionstring It is working fine:

 

 

Posted on Nov 14, 2017 06:47 AM

In App.config you need to add one more connectionString add key with different name. Check the below Settings how add multiple Connection string with different name so can use it by referring with name as ConString or ConString1.

<connectionStrings>
    <add name="ConString" connectionString="Server=.\SQL2005;Database=Test;uid=sa;pwd=pass@1234;" providerName="System.Data.SqlClient"/>
    <add name="ConString1" connectionString="Server=.\SQL2005;Database=Sample;uid=sa;pwd=pass@1234;" providerName="System.Data.SqlClient"/>
</connectionStrings>