private void butAdd_Click(object sender, EventArgs e) { switch (this.Text) { case "Данные о поставщиках": frmProvidersACD prov1 = new frmProvidersACD(myConnection, "add", dgvProviders, null); prov1.ShowDialog(); break; case "Данные о сотрудниках": frmEmployeesAC empl1 = new frmEmployeesAC(myConnection, "add", dgvProviders, null); empl1.ShowDialog(); break; case "Данные о должностях": frmPostsAC posts1 = new frmPostsAC(myConnection, "add", dgvProviders, null); posts1.ShowDialog(); break; case "Данные о животных": frmPets pets = new frmPets(myConnection, "add", dgvProviders, null); pets.ShowDialog(); break; } string connectionString = @"Data Source=.;Initial Catalog=PetShopO;user id=sa; password=1;"; myConnection = new SqlConnection(connectionString); try { myConnection.Open(); } catch (SqlException ex) { MessageBox.Show(ex.Message); ; } }
private void butAdd_Click(object sender, EventArgs e) { frmProvidersACD prov1 = new frmProvidersACD(myConnection, "add", dgv1, null); //prov1.Show(this); prov1.ShowDialog(); //this.Hide(); //fillTheTable(dgvP, "DISPLAY_BREEDS"); fillComboBox(); //cbProv.Text = newProv; }