public void Registry_Get() { RegistryKey registry = Registry.CurrentUser; RegistryKey key = registry.CreateSubKey("Doc_Stol"); try { DS = key.GetValue("DS").ToString(); IC = key.GetValue("IC").ToString(); UI = key.GetValue("UI").ToString(); PW = key.GetValue("PW").ToString(); } catch { ConnectionForm conFrm = new ConnectionForm(); conFrm.ShowDialog(); } finally { sql.ConnectionString = "Data Source = " + DS + "; Initial Catalog = " + IC + "; Persist Security Info = true" + "; User ID = " + UI + "; Password = \"" + PW + "\""; } }
private void конфигурацияПодключенияToolStripMenuItem_Click(object sender, EventArgs e) { ConnectionForm conFrm = new ConnectionForm(); conFrm.ShowDialog(); }