1. Add a reference to System.Configuration.dll
2. Add using System.Configuration;
3. Use the following code:
Configuration c = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
c.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings("conn 1", "Server=local; Database=Test; Password=myPassword; User Id=myUser;"));
ConfigurationSection section = c.GetSection("connectionStrings");
if (section != null)
{
if (!section.IsReadOnly())
{
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
}
}
c.Save();
Thursday, September 28, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment