private void HienThiChiTietSV(frmSuaSV frm) { frm = new frmSuaSV(); frm.Show(); connect.Close(); connect.Open(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.Text; string str = " select * from SinhVien where MaSV = " + dataGridView1.Tag; command.CommandText = str; command.Connection = connect; SqlDataReader reader = command.ExecuteReader(); // hien thi thong tin sv can su len form if (reader.Read() == true) { frm.txtMacu.Text = reader.GetString(0); frm.txtSMaSV.Text = reader.GetString(0); frm.txtSHoTen.Text = reader.GetString(1); frm.txtsNgaySinh.Text = reader.GetDateTime(3).ToString("dd/MM/yyyy") + ""; if (reader.GetString(4) == " Nam ") { frm.radsNam.Checked = true; } else { frm.radsNu.Checked = true; } connect.Close(); } }
private void sửaThôngTinSinhVienToolStripMenuItem_Click(object sender, EventArgs e) { frmSuaSV frm = new frmSuaSV(); HienThiChiTietSV(frm); }