private void btnUpdate_Click(object sender, EventArgs e) { // Declare local variables and objects... int intPosition; // Save the current record position... intPosition = objCurrencyManager.Position; // Set the SqlCommand object properties... std st = new std(); st.stdno = txtstdno.Text; st.name = txtname.Text.Trim(); st.reg_date = txtreg_date.Text; st.father = txtfather.Text.Trim(); st.idno = txtidno.Text.Trim(); st.degree = txtdegree.Text.Trim(); st.course = txtcourse.Text.Trim(); st.birthdate = txtbirthdate.Text; st.job = txtjob.Text.Trim(); st.tel = txttel.Text.Trim(); st.mob = txtmob.Text.Trim(); st.address = txtaddress.Text.Trim(); st.resume = txtresume.Text.Trim(); st.flag = flag; st.photo = photo; st.Update(); // Close the connection... // Fill the DataSet and bind the fields... FillDataSetAndView(); BindFields(); // Set the record position // to the one that you saved... objCurrencyManager.Position = intPosition; // Show the current record position... ShowPosition(); // Display a message that the record was updated... toolStripStatusLabel1.Text = "عملیات ویرایش رکورد با موفقیت انجام شد"; }
private void btnUpdate_Click(object sender, EventArgs e) { std st = new std(); st.stdno = txtstdno.Text.Trim(); st.reg_date = txtreg_date.Text; st.name = txtname.Text.Trim(); st.father = txtfather.Text.Trim(); st.idno = txtidno.Text.Trim(); st.degree = txtdegree.Text.Trim(); st.course = txtcourse.Text.Trim(); st.birthdate = txtbirthdate.Text; st.job = txtjob.Text.Trim(); st.tel = txttel.Text.Trim(); st.mob = txtmob.Text.Trim(); st.address = txtaddress.Text.Trim(); st.resume = txtresume.Text.Trim(); st.flag = flag; st.photo = photo; st.Update(); this.Close(); }