示例#1
0
 public static string GetDBConnection(DBSource dbconstrID)
 {
     if (File.Exists(DBConfigPath))
     {
         XmlTextReader reader = new XmlTextReader(DBConfigPath);
         XmlDocument   doc    = new XmlDocument();
         doc.Load(reader);
         reader.Close();
         XmlNodeList dbconstrs = doc.SelectSingleNode("/root/dbconstrs").ChildNodes;
         XmlNodeList dbs       = doc.SelectSingleNode("/root/dbs").ChildNodes;
         if (GetXMLNodeValue(dbconstrs, "dbconstr", dbconstrID.ToString(), out _dbconstrValue))
         {
             GetXMLNodeValue(dbs, "db", _dbconstrValue, out _dbConnectionString);
         }
         return(_dbConnectionString);
     }
     return(null);
 }