private void button2_Click(object sender, EventArgs e) { this.Hide(); viewmem vm = new viewmem(); vm.Show(); }
public void editDb(string name, string add, string rc_type, string bg, string occ, string mc_status, string num, long con, int ag, long aadh, string gdr, int pd, long acard) { DbAccess db = new DbAccess(); DataTable dt = new DataTable(); string query = "UPDATE members set name = @name, address = @add, contact = @con, age = @ag, aadhar = @aadh, rc_type = @rc_type, mc_status = @mc_status, blood_group = @bg, occupation = @occ, gender = @gdr, paid = @pd, ar_card = @ac WHERE anum = @anum"; SqlCommand comm = new SqlCommand(query); comm.Parameters.AddWithValue("@anum", num); comm.Parameters.AddWithValue("@name", name); comm.Parameters.AddWithValue("@add", add); comm.Parameters.AddWithValue("@rc_type", rc_type); comm.Parameters.AddWithValue("@bg", bg); comm.Parameters.AddWithValue("@occ", occ); comm.Parameters.AddWithValue("@mc_status", mc_status); comm.Parameters.AddWithValue("@con", con); comm.Parameters.AddWithValue("@ag", ag); comm.Parameters.AddWithValue("@aadh", aadh); comm.Parameters.AddWithValue("@gdr", gdr); comm.Parameters.AddWithValue("@pd", pd); comm.Parameters.AddWithValue("@ac", acard); try { db.executeQuery(comm); MessageBox.Show("Updation Successfull", "Mcs-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); viewmem vm = new viewmem(); vm.Show(); } catch (Exception ex) { MessageBox.Show("Something Went Wrong!!", "Mcs-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button3_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Do You Want To Delete Application Number : " + viewmem.db_anum, "MCS-Arogya", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.Yes) { DbAccess db = new DbAccess(); SqlCommand comm = new SqlCommand("DELETE FROM MEMBERS WHERE anum = '" + viewmem.db_anum + "';"); int res = db.executeQuery(comm); if (res > 0) { MessageBox.Show("Application number : " + viewmem.db_anum + " removed from database", "MCS-Arogya", MessageBoxButtons.OK, MessageBoxIcon.Information); } viewmem vm = new viewmem(); this.Hide(); vm.Show(); } }
private void button3_Click(object sender, EventArgs e) { viewmem vm = new viewmem(); vm.Show(); }