Ejemplo n.º 1
0
        private void LadujUstawienia()
        {
            Properties.Settings        settings = new Properties.Settings();
            SqlConnectionStringBuilder builder  = new SqlConnectionStringBuilder();

            builder.DataSource          = settings.Host;
            builder.InitialCatalog      = settings.NazwaBazy;
            builder.PersistSecurityInfo = true;
            builder.UserID   = settings.Login;
            builder.Password = settings.Haslo;

            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            config.ConnectionStrings.ConnectionStrings["Serwis.Properties.Settings.SerwisConnectionString"].ConnectionString = builder.ConnectionString;
            config.Save(ConfigurationSaveMode.Modified, true);
            Properties.Settings.Default["SerwisConnectionString"] = builder.ConnectionString;
            settings.Save();
        }