代码如下:
 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 ;
但是好象起不了作用,谢谢!

解决方案 »

  1.   

    adotable.post
    发生错误,这个异常应该怎么去捕捉
      

  2.   

    还是adotable不能使用事务,各位帮帮忙!急呀....
      

  3.   

    在adotable.post之前,adotable中的记录集必须被修改过,即adotable.edit
      

  4.   

    if not ADO_decinfo.Connection.InTransaction then
        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可以有事务!这样的写法没有错!