//Tìm khách thuê theo quê quán public DataTable TimKhachThueTheoQueQuan(KhachThue khachthue) { String sql = "select * from KHACH_THUE where QueQuan like N'%" + khachthue.getQuequan() + "%'"; rs = manager.executeQuery(sql); return(rs); }
//Sửa khách thuê public bool SuaKhachthue(KhachThue khachthue) { SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); SqlParameter p2 = new SqlParameter("@tenkhach", khachthue.getTenKhach()); SqlParameter p3 = new SqlParameter("@phai", khachthue.getPhai()); SqlParameter p4 = new SqlParameter("@cmnd", khachthue.getCmnd()); SqlParameter p5 = new SqlParameter("@quequan", khachthue.getQuequan()); SqlParameter p6 = new SqlParameter("@nghenghiep", khachthue.getNgheNghiep()); SqlParameter[] giatri = { p1, p2, p3, p4, p5, p6 }; return(manager.Update(@"dbo.[SuaKhachThue]", giatri)); }
//thêm khách thuê public void ThemKhachthue(KhachThue khachthue) { SqlParameter p1 = new SqlParameter("@makhach", khachthue.getMaKhach()); SqlParameter p2 = new SqlParameter("@tenkhach", khachthue.getTenKhach()); SqlParameter p3 = new SqlParameter("@phai", khachthue.getPhai()); SqlParameter p4 = new SqlParameter("@cmnd", khachthue.getCmnd()); SqlParameter p5 = new SqlParameter("@quequan", khachthue.getQuequan()); SqlParameter p6 = new SqlParameter("@nghenghiep", khachthue.getNgheNghiep()); //String insert = "insert into KHACH_THUE values (@makhach, @tenkhach, @phai, @cmnd, @quequan, @nghenghiep)"; SqlParameter[] giatri = { p1, p2, p3, p4, p5, p6 }; manager.Update(@"dbo.[ThemKhachThue]", giatri); }