KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to perform the following query using Dapper, which currently doesn't return expected results (I think it must be treating the @pName param as literal text within the single quotes?): var q = "SELECT * FROM Users WHERE Name LIKE '@pName%'"; @pName is the param I assign a value to upon executing the query. Things work if I just build the SQL like: var q = "SELECT * FROM Users WHERE Name LIKE '" + name + "%'"; .. but I would prefer to use a param if possible. I am executing the query using the following code: o = _cn.Query<User>(q, new { pName = new DbString { Value = name, IsFixedLength = false, Length = 25, IsAnsi = true } }).ToList(); How do I got about this using Dapper?
Tags (comma-separated)
Save Edits
Cancel