Cannot locate row for update, some values may have changed after last read

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.