private void metroButton2_Click(object sender, EventArgs e) { try { string theDate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); this.validateMarks(metroTextBox8.Text.ToString(), metroTextBox7.Text.ToString()); if (metroTextBox1.Text == "" || metroTextBox2.Text == "" || metroTextBox3.Text == "" || metroTextBox10.Text == "" || metroComboBox1.Text == "" || metroComboBox5.Text == "" || theDate == "" || metroComboBox3.Text == "" || metroTextBox5.Text == "" || metroTextBox4.Text == "" || metroTextBox9.Text == "" || metroTextBox6.Text == "" || metroTextBox8.Text == "" || metroTextBox7.Text == "") { MessageBox.Show("Fill the empty fields"); } else { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "update placeExam set Fname='" + metroTextBox1.Text + "',Mname='" + metroTextBox2.Text + "',Lname='" + metroTextBox3.Text + "',Gender='" + metroComboBox1.Text + "',Age='" + metroComboBox5.Text + "',DOB='" + theDate + "',Religion='" + metroComboBox3.Text + "',Nationality='" + metroTextBox10.Text + "',Address='" + metroTextBox5.Text + "',LandNo='" + metroTextBox4.Text + "',MobNo='" + metroTextBox9.Text + "',email='" + metroTextBox6.Text + "',Grade='" + metroComboBox4.Text + "',Interview='" + metroTextBox8.Text + "',Written='" + metroTextBox7.Text + "' where placeID='" + metroLabel21.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Placement Exam Details are updated"); this.Close(); placeExamTable a = new placeExamTable(); a.Show(); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void metroButton4_Click(object sender, EventArgs e) { placeExamTable a = new placeExamTable(); this.Hide(); a.Show(); }
private void metroButton1_Click(object sender, EventArgs e) { try { string theDate = dateTimePicker1.Value.ToString("yyyy-MM-dd"); this.validateMarks(metroTextBox8.Text.ToString(), metroTextBox7.Text.ToString()); if (metroTextBox1.Text == "" || metroTextBox2.Text == "" || metroTextBox3.Text == "" || metroTextBox10.Text == "" || metroComboBox1.Text == "" || metroComboBox5.Text == "" || metroComboBox3.Text == "" || metroTextBox5.Text == "" || metroTextBox4.Text == "" || dateTimePicker1.Text == "" || metroTextBox9.Text == "" || metroTextBox6.Text == "" || metroTextBox8.Text == "" || metroTextBox7.Text == "") { MessageBox.Show("Fill the empty fields"); } else { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into placeExam(Fname,Mname,Lname,Gender,Age,DOB,Religion,Nationality,Address,LandNo,MobNo,email,Grade,Interview,Written) values('" + metroTextBox1.Text + "','" + metroTextBox2.Text + "','" + metroTextBox3.Text + "','" + metroComboBox1.Text + "','" + metroComboBox5.Text + "','" + theDate + "','" + metroComboBox3.Text + "','" + metroTextBox10.Text + "','" + metroTextBox5.Text + "','" + metroTextBox4.Text + "','" + metroTextBox9.Text + "','" + metroTextBox6.Text + "','" + metroComboBox4.Text + "','" + metroTextBox8.Text + "','" + metroTextBox7.Text + "')"; cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Placement Exam Details are entered"); this.Close(); placeExamTable a = new placeExamTable(); a.Show(); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }