Update access cannot be updated and no error is reported

Source: Internet
Author: User

(Reprinted) when updating the ACCESS database today, the parameter method is used, and no error is returned, but the data is not updated. Google found that when access is parameterized, the parameter location must be in the same order as the value assignment. Otherwise, data cannot be updated but no error is reported during the update.
For example, update tablename set [a] = @ A, [B] = @ B where [ID] = @ ID
When adding a parameter, you must add @ A, @ B, and @ ID. That is, you must
Cmd. parameters. addwithvalue ("@ A", a); cmd. parameters. addwithvalue ("@ B", B); cmd. parameters. addwithvalue ("@ ID", ID); if the order is incorrect, it cannot be updated. This is different from SQL Server. In SQL Server, you do not have to worry about the order in which parameters are added.
Because access does not report bugs when the parameters are misplaced during update, but does not update themProgramBe sure to pay attention.

I have encountered this problem before, and I finally refused to accept the error for no reason. After searching for half a day, I finally found a problem that my colleagues encountered ,... Is the Parameter order problem ~~

(Reprinted) when updating the ACCESS database today, the parameter method is used, and no error is returned, but the data is not updated. Google found that when access is parameterized, the parameter location must be in the same order as the value assignment. Otherwise, data cannot be updated but no error is reported during the update.
For example, update tablename set [a] = @ A, [B] = @ B where [ID] = @ ID
When adding a parameter, you must add @ A, @ B, and @ ID. That is, you must
Cmd. parameters. addwithvalue ("@ A", a); cmd. parameters. addwithvalue ("@ B", B); cmd. parameters. addwithvalue ("@ ID", ID); if the order is incorrect, it cannot be updated. This is different from SQL Server. In SQL Server, you do not have to worry about the order in which parameters are added.
Because access does not report bugs when the parameters are misplaced during update, but does not update them, you must pay attention to this when writing programs.

I have encountered this problem before, and I finally refused to accept the error for no reason. After searching for half a day, I finally found a problem that my colleagues encountered ,... Is the Parameter order problem ~~

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.