Skip to content
Advertisement

Issues with Dapper query syntax

little assistance here with my query using dapper, been getting error Message = “ORA-00936: missing expressionn” on my query. I would like to know what am I missing here?

Advertisement

Answer

Firstly with Oracle queries you need to use : instead of @ to denote a parameter placeholder.

Then secondly this code:

will produce an object with a property called RouteId.

This RouteId does not match the name of the parameter in your query, which is Id. They need to match, otherwise there’s no way for the database to bind the parameter to the correct input value.

You can either

  1. change the Sql query:

OR

  1. change the C#:

and use :Id in the SQL.

It doesn’t really matter which, the important thing is that the names match.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement