Search code examples
delphitclientdatasettadodataset

"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). I am using Delphi 2010.

My DatasetProvider between TClientDataset and TAdoDataset :

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

Error occurs in this function which is called by TDataSetResolver.EndUpdate();

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

Solution

  • 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;