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

Last Reply one year ago By kalpesh

Posted one year ago

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



Posted one year ago

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.

    <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"/>