string fs = @"C:\web.config";
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(fs);
XmlNodeList nodeList=xmlDoc.SelectSingleNode("configuration").SelectSingleNode("CloverConfiguration").ChildNodes;
foreach(XmlNode xn in nodeList)
{
try
{
XmlElement xe=(XmlElement)xn;
if(xe.GetAttribute("key")=="Clover.DataAccess.ConnectionString")
{
xe.SetAttribute("value","server=server1;User ID=sa;Password=00000000;database=Clover;Connection Reset=FALSE");
break;
}
}
catch{}
}
xmlDoc.Save(fs);
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(fs);
XmlNodeList nodeList=xmlDoc.SelectSingleNode("configuration").SelectSingleNode("CloverConfiguration").ChildNodes;
foreach(XmlNode xn in nodeList)
{
try
{
XmlElement xe=(XmlElement)xn;
if(xe.GetAttribute("key")=="Clover.DataAccess.ConnectionString")
{
xe.SetAttribute("value","server=server1;User ID=sa;Password=00000000;database=Clover;Connection Reset=FALSE");
break;
}
}
catch{}
}
xmlDoc.Save(fs);