private void BtnDone_Click(object sender, EventArgs e) { try { string suppName = txtSupName.Text; SqlConnection conn = new SqlConnection(conStr); conn.Open(); string inSupplier = "INSERT INTO SupplierTable VALUES (@SupplierName)"; SqlCommand cmd = new SqlCommand(inSupplier, conn); SqlDataAdapter adp = new SqlDataAdapter(); cmd.Parameters.AddWithValue("@SupplierName", suppName); cmd.ExecuteNonQuery(); conn.Close(); stockOrder so = new stockOrder(); so.cmbSupplier.Items.Add(suppName); so.cmbSupplier.SelectedItem = suppName; so.Show(); this.Hide(); } catch (SqlException err) { MessageBox.Show("DATABASE ERROR: \n\n\n" + err.Message); } }
private void AddOrderToolStripMenuItem_Click(object sender, EventArgs e) { stockOrder child4 = new stockOrder(); child4.MdiParent = this; child4.Show(); child4.lblRecievedDate.Visible = false; child4.txtRecievedDate.Visible = false; child4.btnSubmitOrder.Visible = true; child4.btnReSubmit.Visible = true; }