Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
How do I...save and edit or update and read "connection string" in the application configuration file in "RunTime"

app.config
"connectionstring"
"RunTime"
Posted

1 solution

TO read the connectionString at runtiome use the follwoing code:
String str=String.Empty;
str = ConfigurationManager.AppSettings["cc"].ToString();

where cc is the variable defined in web.config file for the user defined connection string. It is used like this:

<appsettings>
   <add key="cc" value="server=servername;uid=username;pwd=password;initial catalog=databasename" />
</appsettings>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900