Problem description:
The parameter method is used to update the ACCESS database. No error is returned, but the data is not updated.
Solution:
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.
Cmd. Parameters. addwithvalue ("@ 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.