private void update_Click(object sender, EventArgs e) { if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "") { sqlcon.Close(); string query = "Update quickpctbl Set Fname ='" + Firstname.Text.Trim() + "', Mname ='" + Middlename.Text.Trim() + "', Lname ='" + Lastname.Text.Trim() + "', Birthday ='" + bday.Text.Trim() + "', Address ='" + Address.Text.Trim() + "', PhoneNumber ='" + Phonenum.Text.Trim() + "', JobPosition ='" + Jobposition.Text.Trim() + "', EmailAddress ='" + Emailadd.Text.Trim() + "' where IdNumber = '" + idnum.Text.Trim() + "'"; SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon); DataTable dtbl = new DataTable(); sda.Fill(dtbl); MessageBox.Show("Successfuly Update!"); } else { MessageBox.Show("Please Input!"); } idnum.Clear(); Firstname.Clear(); Middlename.Clear(); Lastname.Clear(); bday.Text = String.Empty; Address.Clear(); Phonenum.Clear(); Jobposition.Text = String.Empty; Emailadd.Clear(); }
private void newaccount_Click(object sender, EventArgs e) { if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "") { string query = "Insert into quickpctbl VALUES('" + idnum.Text.Trim() + "','" + Firstname.Text.Trim() + "','" + Middlename.Text.Trim() + "','" + Lastname.Text.Trim() + "','" + bday.Text.Trim() + "','" + Address.Text.Trim() + "','" + Phonenum.Text.Trim() + "','" + Jobposition.Text.Trim() + "','" + Emailadd.Text.Trim() + "')"; SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon); DataTable dtbl = new DataTable(); sda.Fill(dtbl); MessageBox.Show("Successfuly Added!"); idnum.Clear(); Firstname.Clear(); Middlename.Clear(); Lastname.Clear(); bday.Text = String.Empty; Address.Clear(); Phonenum.Clear(); Jobposition.Text = String.Empty; Emailadd.Clear(); } else { MessageBox.Show("Please Input!"); } }