Run a Microsoft Access Saved Action Request with Dapper

As the title mentions, is there a way to run a saved Microsoft Access action request using Dapper? By action request, I mean anything that doesn't return results (insert, update, delete).

I tried something like this, but it would be too easy, I think:




source to share

2 answers

Dapper needs to know what it is "MyStoredQuery"

. It does not scan the database schema to see if this line is a normal sql command or the name of a stored procedure. (Well, they are not a stored procedure, but that's the point)

You need to specify CommandType

_connection.Execute("MyStoredQuery", commandType = CommandType.StoredProcedure);


By default, the CommandType is set to a value Text

, which means your string will be standard sql command text like SELECT ...., INSERT INTO .... etc.

It is not possible to test it now, but see if someone with more knowledge of this can give you a better answer. (Hint adds Dapper tag to your question)



Same answer as Steve but "commandType =" didn't work for me. I used "commandType:" as shown below:

_connection.Execute("MyStoredQuery", commandType: CommandType.StoredProcedure);




All Articles