Does Dapper support the like operator?

后端 未结 4 2053
遇见更好的自我
遇见更好的自我 2021-01-30 12:19

Using Dapper-dot-net...

The following yields no results in the data object:

var data = conn.Query(@\"
    select top 25 
    Term as Label, 
    Type, 
          


        
4条回答
  •  春和景丽
    2021-01-30 12:57

    The answer from Sam wasn't working for me so after some testing I came up with using the SQLite CONCAT equivalent which seems to work:

    string sql = "SELECT * FROM myTable WHERE Name LIKE '%' || @NAME || '%'";
    var data = IEnumerable data = conn.Query(sql, new { NAME = Name });
    

提交回复
热议问题