It appears that ADO Access commands require the parameters to be present in the same order as in the SQL query.
In the source code for a query that works, the parameters appear in the query string in alphabetical order -
Update Products Set Description = @Description Where ProductNumber = @ProductNumber
This works because the properties are taken from "product2" in alphabetical order. It may not be in design, it may just be the order in which their reflection is reflected.
In a query that fails, the parameters are displayed in reverse alphabetical order -
Update Products Set ProductNumber = @ProductNumber Where Description = @Description
.. and this fails because parameter values ββare not assigned in Access.
You must confirm this by changing the order of the parameters in the alternate dynamic parameter. I tried to use dynamic parameters, and it worked when the parameters were in the same order in which they appeared in the SQL query, but failed if they were not. The database I'm using is not exactly the same as yours, but the following should illustrate what I'm talking about:
// Doesn't work (parameter order is incorrect) con.Execute( "Update People Set PersonName = @PersonName Where Notes = @Notes", new { Notes = "NotesChanged", PersonName = "New Name" } ); // DOES work (parameter order is correct) con.Execute( "Update People Set PersonName = @PersonName Where Notes = @Notes", new { PersonName = "New Name", Notes = "NotesChanged" } );
While trying to find additional information about this, I came across this answer, which, unfortunately, confirms this problem: https://stackoverflow.com/a/416829/
I think it's possible to create a custom SQL generator , which you mentioned in one of your other questions, to do some magic analyzing the query and getting the parameters in the order in which they should appear, and then make sure that they are provided in the correct okay. If someone supports an access connector for DapperExtensions, then there may be a problem with the problem. Because at the moment I believe that you are right and that this is a problem with the library.