我如何...保存和编辑或更新并阅读“连接字符串”在“RunTime”中的应用程序配置文件中 [英] How do I...save and edit or update and read "connection string" in the application configuration file in "RunTime"
本文介绍了我如何...保存和编辑或更新并阅读“连接字符串”在“RunTime”中的应用程序配置文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
如何...在RunTime中保存并编辑或更新并读取应用程序配置文件中的连接字符串
app.config
connectionstring
RunTime
hi
How do I...save and edit or update and read "connection string" in the application configuration file in "RunTime"
app.config
"connectionstring"
"RunTime"
推荐答案
要在runtiome中读取connectionString,请使用以下代码:
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>
这篇关于我如何...保存和编辑或更新并阅读“连接字符串”在“RunTime”中的应用程序配置文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文