I am evaluation dapper but i already running into some problems.
I am trying to do this
using (IDbConnection connection = GetConnection())
{
connection.Open();
var result = connection.Query(
"select * from myTable where ID_PK = @a;", new { a = 1 });
}
It throws an ORA-00936: missing expression OracleException at line 393 in the SqlMapper.cs
using (var reader = cmd.ExecuteReader())
When i remove the parameter i get the whole table into the result variable.
The query works without problems in sqldeveloper. I am using the Oracle.DataAccess Assembly 2.112.2.0
Dynamic parameters can be strings, measure values, or dates, offering flexibility and interactivity when building a dashboard for your audience. Because they can be easily used in most analytical entities, dynamic parameters give you programmatic control to customize your analysis.
I think oracle has a different schema for named parameter, did you try :a
instead of @a
?
Yes, it works with ":" if we trying to insert records in oracle database table.
Just try like this:
var count = connection.Execute(@"INSERT INTO COMPANY_USER(UserId , UserName) values (:UserId, :UserName)", new[] { new { UserId = 1, UserName = "Sam" }, new { UserId = 2, UserName = "Don" }, new { UserId = 3, UserName = "Mike" } });
It also works with IN list:
var partialList = new List();
var list = await db.QueryAsync("select bla1, blah2 FROM tablename WHERE stringcolumn1 IN :ListofValues", new { ListofValues = partialList });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With