/// <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 }