private void button_Click(object sender, RoutedEventArgs e) { connlay = new ConnectedLayer(); logger.Trace($" Command: Select * From {comboBox.SelectedIndex} "); var oSqlCon = new SqlConnection(connectionString); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings("ConnectionStr", "SomeConnectionString") ); config.Save(); ConnectionStringsSection section = config.GetSection("connectionStrings") as ConnectionStringsSection; if (section.SectionInformation.IsProtected) { section.SectionInformation.UnprotectSection(); } else { section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider"); } config.Save(); string command = $"Select * From {comboBox.SelectedIndex}"; dataGrid.ItemsSource = connlay.Read(command).Tables; }
private void button_Click(object sender, RoutedEventArgs e) { ConnectedLayer conn = new ConnectedLayer(); builder = new SqlConnectionStringBuilder(conn.connectionString); MainWindow main = new MainWindow(); if (textBox.Text == builder.UserID && PasswordBox.Password == builder.Password) { this.Close(); main.Show(); } else { MessageBox.Show("Enter another login"); } }