コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string    UpdateCurrentProduct = "update d__Product set Name = '" + textBox1.Text.Trim() + "', Handling_id = " + comboBox1.SelectedValue + " where ID = " + selectID;
         DataTable dtbl = new DataTable();
         dtbl = DbConnection.DBConnect(UpdateCurrentProduct);
         this.Close();
         MessageBox.Show("Продукт изменён!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Form_Product owner = this.Owner as Form_Product;
         owner.button4_Click_Refresh_Table(null, null);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }