thuvienwinform - Để xem dữ liệu vừa thay đổi (thêm, sửa, xóa) trong CSDL ta sử dụng code sau:
(sử dụng LINQ)
public static bool ChangeData(QLDTDataContext db)
{
int insert = db.GetChangeSet().Inserts.Count;
int update = db.GetChangeSet().Updates.Count;
int delete = db.GetChangeSet().Deletes.Count;
if (insert + update + delete == 0)
{
return false;
}
return true;
}
Kết quả trả vể true nếu có thay đổi và ngược lại
No comments:
Post a Comment