Adotable,access Database, table field A-number type, the default value is 0.
After you add a record,
Http://wenku.baidu.com/view/bd87ea50ad02de80d4d840c8.html
Cannot locate row for update, some value may have been last read (2009-03-11 11:58:22) Tags: it error: Cannot locate row for update, some value may have changed after last read in Delphi 7, Using Adoquery or Adodataset to operate the database is very convenient, can be queried, can be increased deletion.
However, if you modify the data to save and then modify it again , you will encounter an issue where you cannot locate rows for updates, some values may have changed after the last read.
There are several reasons for this:
1. At the time of database design, default values are set for some fields, and after the modifications are committed, the database automatically modifies the default values for all rows of the corresponding field, resulting in inconsistencies between the database and data in the dataset, so that Adoquery (Adodataset) cannot locate the dataset.
2. The database corresponding to the table does not have a primary key, after entering the duplicate data, the database has two identical data, so that adoquery can not locate the data.
Workaround:
1. Modify the database design, no longer set the default value, define the primary key for the database table, and ensure its uniqueness.
2. After Adoquery.post is executed, the executionof the Adoquery.refresh can be resolved for setting the default value. (The Default Value field in the dataset after refresh has a value that is consistent with the database)
3. Use the INSERT INTO SQL statement instead of the Add--post method instead. But this way does not update the other query to open the table, so you have to Requery, refresh does not work.
4. Using Adodataset is the same workaround
Cannot locate row for update, some values may have changed after last read