T
thankl
Unregistered / Unconfirmed
GUEST, unregistred user!
如果我不写以下代码。我在post数据库不立即更新。请问大虾有呵高招!
procedure Tpublic_db.qr_runtimeAfterPost(DataSet: TDataSet);
var bookmark:tbookmark;
begin
if ( db_auto.InTransaction ) then //db_auto为TADOconnction
db_auto.CommitTrans;
if DataSet=qr_runtime then //qr_runtime为TADOquery
begin
try
bookmark:=qr_runtime.GetBookmark;
begin
qr_runtime.Requery;
qr_runtime.GotoBookmark(bookmark);
end;
finally
qr_runtime.FreeBookmark(bookmark);
end;
end;
procedure Tpublic_db.qr_runtimePostError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
begin
db_auto.RollbackTrans;
action:=daabort;
end;
procedure Tpublic_db.qr_runtimeBeforePost(DataSet: TDataSet);
begin
if (not db_auto.InTransaction ) then
db_auto.BeginTrans;
end;
end;
procedure Tpublic_db.qr_runtimeAfterPost(DataSet: TDataSet);
var bookmark:tbookmark;
begin
if ( db_auto.InTransaction ) then //db_auto为TADOconnction
db_auto.CommitTrans;
if DataSet=qr_runtime then //qr_runtime为TADOquery
begin
try
bookmark:=qr_runtime.GetBookmark;
begin
qr_runtime.Requery;
qr_runtime.GotoBookmark(bookmark);
end;
finally
qr_runtime.FreeBookmark(bookmark);
end;
end;
procedure Tpublic_db.qr_runtimePostError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
begin
db_auto.RollbackTrans;
action:=daabort;
end;
procedure Tpublic_db.qr_runtimeBeforePost(DataSet: TDataSet);
begin
if (not db_auto.InTransaction ) then
db_auto.BeginTrans;
end;
end;