如何判断cach中有无更新的数据,记录提交后能否清空cach;(50分)

  • 主题发起人 主题发起人 skytears
  • 开始时间 开始时间
S

skytears

Unregistered / Unconfirmed
GUEST, unregistred user!
如何判断cach中有无更新的数据,记录提交后能否清空cach
 
你可以使用dataset的UpdateStatus属性来判断是否有需要更新的数据。
type
TUpdateStatus = (usUnmodified, usModified, usInserted, usDeleted);
 
给个例子好吗
 
The following example applies cached updates from a master/detail relationship. The updates are applied from the BeforeClose event handler of the detail set. Note that using cached updates in this manner requires that you apply updates any time you change the master record. For more control over cached updates, you must use a client dataset instead.

procedure TForm1.DetailBeforeClose(DataSet: TDataSet);
begin
if Master.UpdatesPending or Detail.UpdatesPending then
if Master.UpdateStatus = usInserted then
Database1.ApplyUpdates([Master, Detail])
else
Database1.ApplyUpdates([Detail, Master]);
end;
 
adoquery1.updatebatch
 
接受答案了.
 
后退
顶部