Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: ADOTable Exception when Deleting Record


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0 Threads: [ Previous | Next ]
Robert Kondner

Posts: 59
Registered: 11/15/01
ADOTable Exception when Deleting Record  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 10, 2016 1:50 PM
Hi,

Delphi XE7 on Win64 Machine building VCL Win32 app.

I have an app that uses ADOTables. (I know but I started with Turbo Database Toolbox long ago.) and I search for a record using a primary key, if found I deleted it. I am getting an exception about being at EOF or BOF or the Record is already deleted.

My Code --> If MyTable.Locate,('LNKID', MyID,[]) then MyTable.Delete;

The record is really there. After doing the Locate I can read valid data from various fields. But when I delete I get the exception.

I debugged down to: ( DoRecordsetDelete procedure in Data.Win.ADODB)

{ When CacheSize > 1, Recordset allows fetching of deleted records. Calling MovePrevious seems to work around it }

if (DataSet.CacheSize > 1) and (PRecInfo(DataSet.ActiveBuffer).RecordNumber <> 1) then
begin
DataSet.Recordset.MovePrevious;
DataSet.Recordset.MoveNext;
end;
DataSet.Recordset.MoveNext; <-- Exception

First I move my cursor location to server, no help.

I then moved the CacheSize to 1 for the tables having problems, FIXED.

It does seem to me that bouncing around with the "Moves" in the solution does not make sense as my record set has only a single record.

Can anyone shed light as to what appears to be a patch and perhaps it is not always correct?

Thanks,
Bob K.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02