config:
<?xml version="1.0"?> <appSettings> <!-- The path about dbConnectionString --> <add key="DBConnectionStringFile" value="D:\C3\config\Microsoft.Msn.Tokyo.DbConnectionString.xml"></add> <!-- The key to get c3ArticleDBConnectionString from dbConnectionstring --> <add key="ConnectionStringKey" value="SearchConnectionString"></add> </appSettings>
读取:
string dbXmlFileName = this.xmlDBConnectionStringFile; XmlDocument xmlD = new XmlDocument(); xmlD.Load(dbXmlFileName); this.strSqlConn = xmlD.SelectSingleNode("/DBConnectionString/" + this.xmlConnectionStringKey).Attributes["value"].Value;