private void UpdateConnectionString(string ConfigPath)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(ConfigPath);
XmlNode parentNode = xmlDocument.DocumentElement;
if (parentNode.Name == "connectionStrings")
{
foreach (XmlNode childNode in parentNode.ChildNodes)
{
if (childNode.Name == "add" && childNode.Attributes["name"].Value=="MySqlConnection")
{
string sqlConnectionString = childNode.Attributes["connectionString"].Value;
SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(sqlConnectionString);
sqlBuilder.InitialCatalog = "yourDatabaseName";
sqlBuilder.IntegratedSecurity = true;
sqlBuilder.Password = "";
childNode.Attributes["connectionString"].Value = sqlBuilder.ConnectionString;
}
}
}
xmlDocument.Save(ConfigPath);
}
Software developer by profession, working for a service and product based organisation in India.
Career graph:
Software Programmer since 2002.
Web Developer in ASP.NET since 2004.
Interests:
I love reading the blogs and articles of technology experts. I love codeproject and stackoverflow .
I love to share knowledge and help the programmers. I appreciate if some body corrects my code or my concepts which helps me learn.