标签:
/// <summary> /// 解析web.config 查询dbType类型 /// </summary> private static void SetDBType() { #region 解析web.config 查询dbType类型 string strPath = HttpContext.Current.Server.MapPath("/") + "Web.config"; XmlDocument doc = new XmlDocument(); doc.Load(strPath); string dbType = ""; XmlNodeList nodeList = doc.SelectNodes(@"configuration/appSettings/add"); foreach (XmlNode nodeitem in nodeList) { if (nodeitem.Attributes["key"] != null && nodeitem.Attributes["value"] != null) { if (nodeitem.Attributes["key"].Value.ToString() == "DBType") { dbType = nodeitem.Attributes["value"].Value; } } } #endregion }
解析ASP,NET MVC 中 web.config XML文件 取出数据库类型
标签:
原文地址:http://www.cnblogs.com/zemax/p/5667680.html