在DatsetProvider的afterupdateRecord事件中处理,具体可参看联机例子。
procedure Tbys.DSPAfterUpdateRecord(Sender: TObject;
SourceDS: TDataSet;
DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind);
const sp=' ';
UpdateKindStr: array[TUpdateKind] of string = ('修改', '添加',
'删除');
var F: TextFile;
s:string;
//str:UpdateKindStr;
begin
try
s:=DateToStr(Date)+SP+TimeToStr(Time)+SP+
(sender as TDataSetProvider).DataSet.Name+sp+UpdateKindStr[UpdateKind];
AssignFile(F, 'd:/log.txt');
if not FileExists('d:/log.txt') then
Rewrite(F);
Append(f);
Writeln(f,s);
Flush(f);
CloseFile(f);
except
raise;
end;
end;