1、我先打开一个维护界面,其中TAdoTable的CursorLoacation为clUseServer,CursorType为ctKeyset
   2、然后我再打开一个带事务的程序:
      if not qry.Connection.InTransaction then
      qry.Connection.BeginTrans;
      try
        qry.Connection.CommitTrans;
      except
        qry.Connection.RollbackTrans;
      end;
   3、随便我打开任何一个程序,都抱下列错误;
       ITransaction:Commit or ITransaction::Abort was called, and object is in a Zombie state.
   4.发现如果第2步没有事务,则第三步不会报错,
   5.发现如果第1步TAdoTable的CursorLoacation为clUseClient,则第三步不会报错
希望大家给出解决方法,由于我程序的要求1,2两步必须按现在设置。

解决方案 »

  1.   

    你的设计有问题吧,你不知道自己的qry是否处在事务中,要用2的代码
      

  2.   

    if not qry.Connection.InTransaction then
          qry.Connection.BeginTrans;
          try
            qry.Connection.CommitTrans;
          except
            qry.Connection.RollbackTrans;
          end;if not qry.Connection.InTransaction then是判断事务的,难道你不知道!
      

  3.   

    经仔细测试发现以下问题:
    1、我先打开一个维护界面,其中TAdoTable的CursorLoacation为clUseServer,CursorType为ctKeyset
    2、然后我再打开一个带事务的程序:
          if not qry.Connection.InTransaction then
          qry.Connection.BeginTrans;
          try
            qry.Connection.CommitTrans;
          except
            qry.Connection.RollbackTrans;
          end;
    3、随便我打开任何一个程序,都报下列错误;
           ITransaction:Commit or ITransaction::Abort was called, and object is in a Zombie state.
    对于3如果打开的窗体,FormStyle为fsNormal则不报错,如果为fsMDIChild则报错。
      

  4.   

    可以看看下面的图片,来解决问题!
    http://bbs.2ccc.com/topic.asp?topicid=129581