// cap nhat thong tin hoc sinh public int Update(HocSinhDTO Hs) { string sql = "update HOCSINH set HoTen=@hoten,GioiTinh=@gioitinh,SoDienThoai=@sodienthoai,HoTenCha=@hotencha,NgheNghiepCha=@nghenghiepcha,HoTenMe=@hotenme,NgheNghiepMe=@nghenghiepme,NgaySinh=@ngaysinh,DiaChi=@DiaChi where MaHS=@mahs"; SqlParameter[] sp = new SqlParameter[10]; sp[0] = new SqlParameter("@mahs", Hs.MaHS); sp[1] = new SqlParameter("@hoten", Hs.HoTen); sp[2] = new SqlParameter("@gioitinh", Hs.GioiTinh); sp[3] = new SqlParameter("@sodienthoai", Hs.SoDienThoai); sp[4] = new SqlParameter("@hotencha", Hs.HoTenCha); sp[5] = new SqlParameter("@nghenghiepcha", Hs.NgheNghiepCha); sp[6] = new SqlParameter("@hotenme", Hs.HoTenMe); sp[7] = new SqlParameter("@nghenghiepme", Hs.NgheNghiepMe); sp[8] = new SqlParameter("@ngaysinh", Hs.NgaySinh); sp[9] = new SqlParameter("@DiaChi", Hs.DiaChi); return conectData.Insert_Update_Delete(sql, sp); }
/// them hoc sinh public int Insert(HocSinhDTO Hs) { string sql = "insert into HOCSINH values (@MaHS,@HoTen,@GioiTinh,@SoDienThoai,@HoTenCha,@NgheNghiepCha,@HoTenMe,@NgheNghiepMe,@NgaySinh,@DiaChi)"; SqlParameter[] sp = new SqlParameter[10]; sp[0] = new SqlParameter("@MaHS", Hs.MaHS); sp[1] = new SqlParameter("@HoTen", Hs.HoTen); sp[2] = new SqlParameter("@GioiTinh", Hs.GioiTinh); sp[3] = new SqlParameter("@SoDienThoai", Hs.SoDienThoai); sp[4] = new SqlParameter("@HoTenCha", Hs.HoTenCha); sp[5] = new SqlParameter("@NgheNghiepCha", Hs.NgheNghiepCha); sp[6] = new SqlParameter("@HoTenMe", Hs.HoTenMe); sp[7] = new SqlParameter("@NgheNghiepMe", Hs.NgheNghiepMe); sp[8] = new SqlParameter("@NgaySinh", Hs.NgaySinh); sp[9] = new SqlParameter("@DiaChi", Hs.DiaChi); return conectData.Insert_Update_Delete(sql, sp); }