private void button4_Click(object sender, EventArgs e) { string lname = tblname.Text; string mname = tbmname.Text; string fname = tbfname.Text; char gender; if (cbgender.Text == "Female") { gender = 'F'; } else { gender = 'M'; } string address = tbaddress.Text; string contact = tbcontactNumber.Text; string bday = tbbday.Text; string position = cbposition.Text; if (tblname.Text != "" && tbmname.Text != "" && tbfname.Text != "" && tbaddress.Text != "" && cbgender.Text != "" && tbcontactNumber.Text != "" && cbposition.Text != "" && tbbday.Text != "") { try { conn.Open(); MySqlCommand comm = new MySqlCommand("UPDATE profile SET lastname = '" + lname + "', middlename = '" + mname + "', firstname = '" + fname + "', gender = '" + gender + "', address = '" + address + "', contactNumber = '" + contact + "', birthdate = '" + bday + "' WHERE personID = " + id, conn); comm.ExecuteNonQuery(); comm = new MySqlCommand("UPDATE employee SET position = '" + position + "' WHERE employeeID = " + id, conn); comm.ExecuteNonQuery(); MessageBox.Show("Profile Edited Successfully"); this.Dispose(); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); conn.Close(); } } else if (tbbday.Text.Substring(4) != "-" || tbbday.Text.Substring(7) != "-") { MessageBox.Show("Please use valid birthdate format"); } else { MessageBox.Show("Please Enter Required Fields"); } employ.refreshEdit(); }