private void update_Click(object sender, EventArgs e) { try { String con = ConfigurationManager.ConnectionStrings["WindowsFormsApplication1.Properties.Settings.librarayManagementConnectionString"].ConnectionString; SqlConnection sqlCon = new SqlConnection(con); sqlCon.Open(); String query = "UPDATE member_registration SET first_name ='" + first_name.Text + "',last_name ='" + last_name.Text + "' ,reg_no ='" + reg_no.Text + "',roll_no='" + roll_no.Text + "',session ='" + session.Text + "',course_name='" + course_name.Text + "',member_type='" + member_type.Text + "',department='" + department.Text + "',date='" + date.Text + "',sex='" + sex.Text + "',address='" + address.Text + "',fine='" + fine.Text + "' WHERE member_id='" + member_id.Text + "'"; SqlCommand cmd = new SqlCommand(query, sqlCon); cmd.ExecuteNonQuery(); MessageBox.Show("Record has been Updated"); sqlCon.Close(); member_view mv = (member_view)Application.OpenForms["member_view"]; mv.loadData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void allMembersToolStripMenuItem_Click(object sender, EventArgs e) { member_view mView = new member_view(account); mView.Show(); }