请看下面的 代码:
fData.dbProperty.StartTransaction;
try
   qCommit.ExecSQL;
   fData.dbProperty.Commit;
except
   fData.dbProperty.Rollback;
   Application.MessageBox('连接数据库失败,请与系统管理员联系!','提示',0+64);
end;
明明已经start了事务,为什么报这种错误:
no user transaction is currently in progress.
rollback transaction没有对应的begin transaction?

解决方案 »

  1.   

    开始事务是ADOConnection1.BeginTrans提交事务是 Commit
      

  2.   

    我用的是database控件,不是adoCONNECTION.
      

  3.   

    with CustomerQuery do
      begin
      Database1.StartTransaction;
        try
          ApplyUpdates; {try to write the updates to the database};
          Database1.Commit; {on success, commit the changes};
        except
          Database1.Rollback; {on failure, undo the changes};
        raise; {raise the exception to prevent a call to CommitUpdates!}
        end;
      CommitUpdates; {on success, clear the cache}
      end;
      

  4.   

    明白了
    是insert 触发器的原因导致的问题。
    我的语句没有问题。呵呵!