Пример #1
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     try
     {
         if (cnx.State == ConnectionState.Closed)
         {
             cnx.Open();
         }
         if (textBox1.Text != "")
         {
             SqlCommand cmd = new SqlCommand();
             cmd.Connection  = cnx;
             cmd.CommandText = "insert into tribunal(tribunal) values(@tribunal)";
             SqlParameter p = new SqlParameter("@tribunal", textBox1.Text);
             cmd.Parameters.Add(p);
             cmd.ExecuteNonQuery();
             MessageBox.Show("تم اظافة المحكمة بنجاح", "الاظافة", MessageBoxButtons.OK);
             cnx.Close();
             this.Close();
             history.AddHistory(" المحكمة", "الاظافة", textBox1.Text);
             cnx.Close();;
             ma.gettribunal();
             this.Close();
         }
         else
         {
             MessageBox.Show("يجب ملا الخانة", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }