asp.net C# 获得配置文件AppSettings 的值

using System.Configuration;//导入命名空间

//配置文件 Web.config
<appSettings>
<!--数据连接字符串-->
<add key="SqlConnectionStr" value="server=.;uid=sa;pwd=sa;database=RCCMS"/>
</appSettings>

//在程序里获得配置文件的Key对应的值
System.Configuration.ConfigurationSettings.AppSettings["SqlConnectionStr"];

猜你喜欢

转载自www.cnblogs.com/chenze-Index/p/10277852.html