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

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:



Download FREE API for Word, Excel and PDF in ASP.Net: Download
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.

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