我正在使用dapper
micro orm与sql server
结合使用。
string author = "some author name";
var get_book_from_name = "SELECT BookId FROM Author WHERE FirstName OR LastName LIKE('%' +@AuthorName +'%')";
var data = this.db.Query<Book>(getBookFromAuthorName, new { AuthorName = author }).SingleOrDefault();
我在查询语句中使用OR语句收到错误。
答案 0 :(得分:4)
SELECT BookId FROM Author WHERE
FirstName LIKE '%'+@AuthorName+'%' OR LastName LIKE '%'+@AuthorName+'%'