(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 ~~