public static string GetConfigStr(string Key)
{
//获取网站配置字段的键值
System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
string ConfigStr=((string)(configurationAppSettings.GetValue(Key, typeof(string))));
return ConfigStr.Trim();
// }
请问其中的.GetValue(Key, typeof(string)怎么理解啊?typeof(string)是什么意思?为什么()里面是个string?
相当于
Object.GetType()
configurationAppSettings
该类又有这么一个方法getvalue,表示根据"键"取"值";
WEB.CONFIG中存储的都是键值对。TYPE(STRING)返回类型就是string类型
{
//组合成数据库的连接字符串\
return GetConfigStr(MdbJetKey)+ HttpRuntime.AppDomainAppPath.ToString()+GetConfigStr(MdbPathKey);
// }
其中GetConfigStr(MdbJetKey)
这个 MdbJetKey 是啥意思呢?和AppsSettings里面的key键值名称不一样啊?<appSettings>
<!-- 此处显示用户应用程序和配置的属性设置。-->
<!-- 示例:<add key="settingName" value="settingValue"/> -->
<add key="kysjMdbPath" value="css/#css 1.mdb" />
<add key="kysjMdbJet" value="Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=123123;User ID=Admin;Data Source=" />
</appSettings>那个这个MdbJetKey参数么意义呢?换个名字叫AB行吗?
我就是不明白这个MdbJetKey,它对应的谁和谁啊?