Readconfig ("noah.bsp", ref connect, ref database);
String TableName = database + ". dbo. Oum_organization ";
<summary>
XML read configuration file
</summary>
private void Readconfig (string databasealias, ref string connect, ref string database)
{
string ss = String. Empty;
DatabaseAlias = Databasealias.tolower ();
String path = Httpruntime.appdomainapppath + "\\Inspur.Finix.config";
XmlTextReader reader = new XmlTextReader (path); New A XmlTextReader instance
XmlDocument doc = new XmlDocument ();
Doc. Load (reader);//
Reader. Close ();//Turn reader off, otherwise the config file becomes read-only
XmlNodeList nodeList = doc. selectSingleNode ("//components"). ChildNodes;
foreach (XmlNode n in nodeList)
{
if (DatabaseAlias = = n.attributes["Name"]. Value.tolower ())
{
SS = n.firstchild.attributes["Name"]. Value;
}
}//end foreach
if (!string. IsNullOrEmpty (ss))
{
if (ss. Contains ("server"))
SS = ss. Replace ("Server", "Data Source");
string[] STRs = ss. Split (';');
if (STRs. Length >= 4)
{
Connect = Strs[0] + ";" + strs[1] + ";" + strs[2] + ";";
Database = Strs[3]. Split (' = ') [1];
}
}
}
Get profile database name