您现在的位置是:首页
>
读取配置文件失败是什么意思 .net 读取非标准配置文件的小例子
. et 读取非标准配置文件的小例子 这篇文章介绍了 et 读取非标准配置文件的小例子 有需要的朋友可以参考一下 代码如下复制代码 代码如下: u lic tatic tri g Co fig t
.net 读取非标准配置文件的小例子
这篇文章介绍了 net 读取非标准配置文件的小例子 有需要的朋友可以参考一下代码如下
复制代码 代码如下: public static string Config(string key) { ExeConfigurationFileMap file = new ExeConfigurationFileMap(); file ExeConfigFilename = @"ProvidersProvider config"; Configuration config = ConfigurationManager OpenMappedExeConfiguration(file ConfigurationUserLevel None); AppSettingsSection appsection = (AppSettingsSection)config GetSection("appSettings"); return appsection Settings[key] Value; }配置文件目录结构

复制代码 代码如下: <?xml version=" " encoding="utf " ?> <configuration> <appSettings> <add key="ConnectionString" value="Server=(local);Database=DB;User Id=sa;Password= " /> </appSettings> </configuration>
调用
复制代码 代码如下: lishixinzhi/Article/program/net/201311/14052 很赞哦! (1043)