Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

App Setting Data Key

Is there a way to save my data source keys in a text file list which the Web.Config reads?

If not...what is the best way of adding an appsetting data source name like the one below without having to kick anyone off of the server?

<add name="myGG" connectionString="Data Source=myDataBase;Initial Catalog=myGG;Integrated Security=True" providerName="System.Data.SqlClient" />
Avatar of angus_young_acdc
angus_young_acdc
Flag of United Kingdom of Great Britain and Northern Ireland image

Why not have different keys but have different names?  

<add name="myGG1" connectionString="Data Source=myDataBase;Initial Catalog=myGG;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="myGG2" connectionString="Data Source=myDataBase;Initial Catalog=myGG;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="myGG3" connectionString="Data Source=myDataBase;Initial Catalog=myGG;Integrated Security=True" providerName="System.Data.SqlClient" />

^ for example.

Then have another section where you configure which to select
<add key="MyConnectionToPick" value="myGG2"/>

So in your code instead of stating you want specifically "myGG2" you say you want the connection stated in MyConnectionToPick.
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Please watch for follow-up questions