private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { bt.Zamknij(); Baza = new Bazadanych(textBox1.Text, comboBox1.Text); dataGridView1.DataSource = null; dataGridView2.DataSource = null; dataGridView1.Rows.Clear(); dataGridView2.Rows.Clear(); string[] t = new string[1]; t = Baza.GetTableNames(); foreach (var item in t) { dataGridView1.Rows.Add(item.ToString()); } dataGridView2.DataSource = Baza.GetTableData(t[0]); label2.Text = t[0]; }
private void button1_Click(object sender, EventArgs e) { if (button1.Text == "Połącz") { label1.Enabled = true; label2.Enabled = true; label3.Enabled = true; label4.Enabled = true; label5.Enabled = true; label6.Enabled = true; dataGridView1.Enabled = true; dataGridView2.Enabled = true; comboBox1.Enabled = true; button1.Text = "Rozłącz"; bt = new Bazadanych(@textBox1.Text); foreach (var item in bt.GetBaseNames()) { comboBox1.Items.Add(item.ToString()); } } else { label1.Enabled = false; label2.Enabled = false; label3.Enabled = false; label4.Enabled = false; label5.Enabled = false; label6.Enabled = false; dataGridView1.Enabled = false; dataGridView2.Enabled = false; comboBox1.Enabled = false; button1.Text = "Połącz"; comboBox1.Text = ""; comboBox1.Items.Clear(); Baza.Zamknij(); } }