比如这样设置:
AdoQuery.LockType=ltBatchOptimistic;
这就表示数据可以批量提交;那么当AdoQuery.delete 一条记录,但是没有提交,
然后用AdoQuery.FilterGroup := fgPendingRecords;  过滤出刚才删除的那条记录,现在我想通过 AdoQuery.Fields[0].OldValue 把刚才删除的值读出来,可惜不行啊,读的时候会报  Bof Eof不能同时为真 这样的错误;为什么,为什么,未提交的删除记录就没有办法读出,希望大家帮忙探讨一下。

解决方案 »

  1.   

    先看adoquey 的delete
    Call Delete to remove the active record from the database. If the dataset is inactive, Delete raises an exception. Otherwise, Delete:
     
    Verifies that the dataset is not empty (and raises an exception if it is).
     
    Calls CheckBrowseMode to post any pending changes to a prior record if necessary.
     
    Calls the BeforeDelete event handler.
     
    Deletes the record.//在此删除记录
     
    Frees any buffers allocated for the record.
     
    Puts the dataset into dsBrowse mode.
     
    Resynchronizes the dataset to make the next undeleted record active. If the record deleted was the last record in the dataset, then the previous record becomes the current record.
     
    Calls the AfterDelete event handler.
    For instance, set FilterGroup to fgPendingRecords to show just the rows that have been modified since the last update(修改的记录,这时候需要认真比较删除的记录是否可用) application.
      

  2.   

    报 Bof Eof的错误 显然是你所取的数据是不存在的
      

  3.   

    哎,我是为了根据删除的 关键字的值,来生成 删除语句,比如:
    'delete from .. where   ...=AdoQuery.fields[0].OldValue ';
    否则,我没有办法处理提交删除的数据的功能;
    虽然,可以用UpdateBatch 执行批量提交数据;
    但是,这个只能出来单表维护,如果要求多表显示,单表更新就不行了。
    而且现在谁写了个select 语句,会仅仅只是一个表呢。
    基本都是多表关联。单表更新;
      

  4.   

    哎,其实我就是为了实现多表关联,单表更新,
    使用 AdoQuery.UpdateBatch 最方便,但是 AdoQuery.UpdateBatch 在实现 多表关联单表更新的时候却不好实现,希望楼上的几位热心的朋友,请您关注一下我刚发的这个帖子:http://community.csdn.net/Expert/topic/4808/4808741.xml?temp=.7489282