Demo Cloud

Demo Cloud

  • 1.9k
  • 140
  • 6.8k

How to select the connnection string during runtime?

Dec 7 2020 4:27 AM
Hello,
How to select the connection string from multiple instances in web config file using web api controller?
 
<connectionStrings>
<add name="client_db1" connectionString="Data Source=DESKTOP;Initial Catalog=Client1;User ID=sa;Password=****;" />
<add name="client_db2" connectionString="Data Source=DESKTOP;Initial Catalog=Client2;User ID=sa;Password=****;" />
<add name="client_db3" connectionString="Data Source=DESKTOP;Initial Catalog=Client3;User ID=sa;Password=****;" />
</connectionStrings>
 
Please help 
Thanks 

Answers (10)