コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox2.Text != string.Empty && textBox3.Text != string.Empty && textBox4.Text != string.Empty)
         {
             string    FillSNOCom = "exec dbo.FillCurrentSNO '" + UserAID + "','" + textBox2.Text.Replace(",", ".") + "','" + dateTimePicker1.Value.Date.ToString() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "'";
             DataTable dataTable  = DbConnection.DBConnect(FillSNOCom);
             MessageBox.Show("Запись добавлена!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
             SnoComForm main = this.Owner as SnoComForm;
             main.GetSNO();
         }
         else
         {
             MessageBox.Show("Заполните данные!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text != String.Empty && textBox2.Text != String.Empty && textBox3.Text != String.Empty)
         {
             string UpdateCurrentSNO = "exec dbo.UpdateCurrentSNO '" + User_AID + "','" + textBox1.Text.Replace(",", ".") + "','" + dateTimePicker1.Value.Date.ToString() + "','" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "'," + selectID;
             DbConnection.DBConnect(UpdateCurrentSNO);
             MessageBox.Show("Изменено!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
             SnoComForm main = this.Owner as SnoComForm;
             main.GetSNO();
         }
         else
         {
             MessageBox.Show("Заполните все поля!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }