As the title mentions, is there any way to run a stored Microsoft Access action query with Dapper? By action query I mean anything that doesn't return results (insert, update, delete).
I tried something like this but that would have been too easy I guess:
Dapper needs to know what is
"MyStoredQuery". It doesn't scan the database schema to find out if that string is a normal sql command or the name of a stored procedure. (Well they are not really stored procedure but this is the meaning)
You need to specify the CommandType
_connection.Execute("MyStoredQuery", commandType = CommandType.StoredProcedure);
By default the CommandType is set to
Text and this means that your string is expected to be a normal sql command text like SELECT...., INSERT INTO .... etc...
Not able to test it now, but let's see if someone with more knowledge about this could give you a better answer. (Hint add the Dapper tag to your question)
Same answer as Steve except however "commandType=" did not work for me. I used "commandType:" as shown below:
_connection.Execute("MyStoredQuery", commandType: CommandType.StoredProcedure);