0
votes

How can i use 2 connection strings with same connection string name

but differ in IP using OR condition Web.config in asp.net

when any one fails other should respond.

First Connection string:

add name="ConnectionString" connectionString="Data Source = 10.10.1.1\SQLEXPRESS ; Database = stores; User ID = sa; pwd = ********" providerName="System.Data.SqlClient"

Second Connection string:

add name="ConnectionString" connectionString="Data Source = 10.10.1.2\SQLEXPRESS ; Database = stores; User ID = sa; pwd = ********" providerName="System.Data.SqlClient"

1

1 Answers

0
votes

You dont need to add two connection strings, just add a fail over partner in connection string

add name="ConnectionString" connectionString="Data Source = 10.10.1.1\SQLEXPRESS ; Failover Partner= 10.10.1.2\SQLEXPRESS ; Database = stores; User ID = sa; pwd = ********" providerName="System.Data.SqlClient"