c#

private static string ConStr = ""; private static string ConString
{
get
{
if(ConStr == "")
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load("ServerConfig.xml");
string userid = doc.SelectSingleNode("ServerConfig/UserId").InnerText;
string password = doc.SelectSingleNode("ServerConfig/PassWord").InnerText;
string servername = doc.SelectSingleNode("ServerConfig/ServerName").InnerText;
string database = doc.SelectSingleNode("ServerConfig/DataBase").InnerText;
ConStr = "User ID = " + userid + ";Data Source = " + servername + ";Initial Catalog = " + database + ";Provider = SQLOLEDB.1;password = " + password;
}
catch(Exception ex)
{
throw ex;
}
} return ConStr;
}
}