简体   繁体   English

“ bof或eof为true或当前记录已删除。。” applyupdates上的错误,其中包含删除操作

[英]“either bof or eof is true or the current record has been deleted..” error on applyupdates that contains a delete operation

I am getting this error while resolving delete operation from ClientDatset to TAdoDataset (which bound to access table). 解决从ClientDatset到TAdoDataset(绑定到访问表)的删除操作时遇到此错误。 I am using Delphi 2010. 我正在使用Delphi 2010。

My DatasetProvider between TClientDataset and TAdoDataset : 我在TClientDataset和TAdoDataset之间的DatasetProvider:

object dspTarifeler: TDataSetProvider
  DataSet = DM.qryTarifeler    
  ResolveToDataSet = True
  Options = [poPropogateChanges, poUseQuoteChar]
end

Error occurs in this function which is called by TDataSetResolver.EndUpdate(); TDataSetResolver.EndUpdate()调用此函数时发生错误。

procedure TCustomADODataSet.InternalGotoBookmark(Bookmark: Pointer);
begin
  Recordset.Bookmark := POleVariant(Bookmark)^;
end;

I've had the same issue with TAdoDataset. 我在TAdoDataset中遇到了同样的问题。 Haven't found what's wrong with it, so I just overrided the method in try except block. 尚未发现问题所在,因此我只是在try除了块中重写了该方法。

Try this: 尝试这个:

TADODataset = class(ADODB.TADODataSet)
  public
    procedure InternalGotoBookmark(Bookmark: Pointer); override;
  end;

{ TADODataset }

procedure TADODataset.InternalGotoBookmark(Bookmark: Pointer);
begin
  try
    inherited InternalGotoBookmark(Bookmark);
  except

  end;
end;

I had to bypass the provider and apply delete operation manually. 我不得不绕过提供程序并手动应用删除操作。 it keeps error in Debug mode, but i can live with that. 它在调试模式下保持错误,但是我可以忍受。

procedure Tfrm.dspTarifelerBeforeUpdateRecord(Sender: TObject;
  SourceDS: TDataSet; DeltaDS: TCustomClientDataSet; UpdateKind: TUpdateKind;
  var Applied: Boolean);
begin
  if updatekind = ukDelete then
  begin
   if dm.qryTarifeler.Locate('Prefix',DeltaDs['Prefix'],[]) then
      dm.qryTarifeler.Delete;
   applied := true;
  end;
end;

For some unexplainable cause which I cannot guess, I believe that after the delete the bookmark parameter of InternalGotoBookmark is going to the deleted record position... 对于某些我无法猜测的无法解释的原因,我相信删除InternalGotoBookmark的书签参数后,将转到删除的记录位置...

So, the Linas solution would make the thing work... 因此,Linas解决方案将使事情变得可行...

But I agree with others, swallowing the exception is bad.... 但是我同意其他人的观点,吞没例外是不好的。

尝试设定

ResolveToDataSet = False

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM