Does Dapper support the like operator?

后端 未结 4 2041
遇见更好的自我
遇见更好的自我 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 13:14

    Yes it does. This simple solution has worked for me everytime:

    db.Query("SELECT * 
                         FROM Remitentes 
                         WHERE Nombre LIKE @n", new { n = "%" + nombre + "%" })
                       .ToList();
    

提交回复
热议问题