Link to home
Start Free TrialLog in
Avatar of isaka
isaka

asked on

ADOTable erro message: The specified row could not be located for updating; Some values may have been changed since it was last read.

Hi there,

I'm working with ADO tables, and when I update the row, I get a message:

The specified row could not be located for updating; Some values may have been changed since it was last read.

I readed some "help" for the same problem at Visual Basic and how to solve it with Resync method, but the same method I can't call on Delphi.

Thanks
Avatar of mullet_attack
mullet_attack

Problem occurs because you are using an autoinc field in your table and the ADO datset does not re-read the record after it is written. So when you try to edit the record later, the dataset doesn't know the value for that field, assumes it to be zero, and bang -> error !

Try This:

procedure TForm1.ADOTable1AfterPost
DataSet: TDataSet);
begin
  TCustomAdoDataSet(dataset).requery;
end;

This will stop your error, however the downside is that the current record is reset to the first record. Solve that by using bookmarks etc and logic that is particular to your app.
ASKER CERTIFIED SOLUTION
Avatar of garybalsamo
garybalsamo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of isaka

ASKER

Adjusted points from 100 to 150
Avatar of isaka

ASKER

If I use the bookmark than I have very ofen message that the bookmark is invalid.
Any suggestions?
I take it another user hasn't updated the record?

Do you move off the record in any way from any other event?