文章出處
文章列表
讀取web.config數據,可以不用編譯。如發布后,非常有用
web.config文件
<configuration>
<appSettings> <add key="Pwd" value="yms6666" /> </appSettings> </configuration> c#后臺代碼讀取Key為Pwd的數據
string pwd= System.Configuration.ConfigurationManager.AppSettings["Pwd"];
連接字符串:
return new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["WebJakeCS"].ConnectionString);
return new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["WebJakeCS"].ToString());
文章列表
全站熱搜