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

StackOverflow https://stackoverflow.com/questions/1859609

Question

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;
Was it helpful?

Solution 2

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;

OTHER TIPS

I've had the same issue with TAdoDataset. Haven't found what's wrong with it, so I just overrided the method in try except block.

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;

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...

So, the Linas solution would make the thing work...

But I agree with others, swallowing the exception is bad....

Try to set

ResolveToDataSet = False
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top