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

Last Reply 7 months ago By kalpesh

Posted 7 months ago

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



You are viewing reply posted by: kalpesh 7 months ago.
Posted 7 months 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"/>


I agree, here is the link: