views:

394

answers:

4

Hello,

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;
A: 

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;
Linas
Thanks for the reply. It doesn't complete the job. Hiding error doesn't work. Do u know any working way to hide it?
AhmetC
I am not considering to change vcl source, though i doubt it works because, hiding it without a fix causes another errors. Thanks anyway..
AhmetC
A: 

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;
AhmetC
A: 

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

Fabricio Araujo
A: 

Try to set

ResolveToDataSet = False
Jørn E. Angeltveit