代码如下:
if not ADO_decinfo.Connection.InTransaction then
begin
Ado_decinfo.Connection.BeginTrans ;
try
Ado_decinfo.post ;
Ado_decinfo.Connection.CommitTrans ;
except on E:Exception do
Ado_decinfo.Connection.RollbackTrans ;
end
end ;
但是好象起不了作用,谢谢!
if not ADO_decinfo.Connection.InTransaction then
begin
Ado_decinfo.Connection.BeginTrans ;
try
Ado_decinfo.post ;
Ado_decinfo.Connection.CommitTrans ;
except on E:Exception do
Ado_decinfo.Connection.RollbackTrans ;
end
end ;
但是好象起不了作用,谢谢!
发生错误,这个异常应该怎么去捕捉
begin
Ado_decinfo.Connection.BeginTrans ;
try
if ADO_DecInfo.Status in [dsEdit] then //加这句
Ado_decinfo.post ;
Ado_decinfo.Connection.CommitTrans ;
except on E:Exception do
Ado_decinfo.Connection.RollbackTrans ;
end
end ;关于PostError的捕捉
可以在ADOTable里有这样一个事件 onPostError吧,记不太清
ADO可以有事务!这样的写法没有错!