Board index » delphi » Exception raises on CancelUpdates

Exception raises on CancelUpdates

If i have a table in batchupdate mode and a DialogBox, that when the user
presses the cancel button it calls the CancelUpdates method, writting just
this code raises the following exception:
  "Row handle referred to a deleted row or a row marked for deletion."

  MyTable.Append;
  MyTable.FieldByName('Field1').AsString:='Text';
  MyTable.Post;
  DialogBox:=TAppendForm.Create(nil);
  try
    DialogBox.ShowModal
  finally
    DialogBox.Free;
  end;

I'm using Access 2k, win98 and delphi5.  Everything with the latest UPs.
What am i missing??

 

Re:Exception raises on CancelUpdates


There's a bug in the CancelBatch method which gets called from
within the CancelUpdates method.
Follow this link for the details:
http://web.orbitel.bg/vassil/BUGS.htm#BUG_TCustomADODataSet_CancelBatch

--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Re:Exception raises on CancelUpdates


I read that page, and according to it,  i should call the MyTable.First
method, or anything that moves the cursor to a known record, just after
doing the CancelBatch operation. The thing is that the exception raises
inside the  CancelBatch method.  To be exact, in the method
InternalGetRecord of the ADODB.PAS file. line 4042.
A line that reads:
  Bookmark := Recordset.Bookmark;

After the exception  the stack reads as follows:
  TCustomADODataset.CancelBatch(arCurrent)
  TDataset.ReSync
  TCustomADODataset.GetRecord('|',gmCurrent,false)
  @CheckAutoResult
   TCustomADODataset.InternalGetRecord( [some raw data],gmPrior,True)

Quote
"Vassil Nazarov" <vas...@mail.orbitel.bg> wrote in message

news:3bbba37c_2@dnews...
Quote
> There's a bug in the CancelBatch method which gets called from
> within the CancelUpdates method.
> Follow this link for the details:
> http://web.orbitel.bg/vassil/BUGS.htm#BUG_TCustomADODataSet_CancelBatch

> --
> Vassil Nazarov
> http://web.orbitel.bg/vassil/

Re:Exception raises on CancelUpdates


Quote
> The thing is that the exception raises
> inside the  CancelBatch method.  To be exact, in the method
> InternalGetRecord of the ADODB.PAS file. line 4042.
> A line that reads:
>   Bookmark := Recordset.Bookmark;

Yes, you are right. It's only possible to fix this bug by overriding the
CancelBatch method. At the link below you can get the FWS
TBetterADODataSet that fixes this and a number of other bugs.

HTH
--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Other Threads