drh*_*lau 6 .net linq linq-to-sql
我正在尝试检索包含"Britney Spears"的字符串列表,这就是我使用的内容
from p in Objects
where p.Title.Contains("Britney Spears")
select p
Run Code Online (Sandbox Code Playgroud)
这很好,但是如果我想选择"Britney Jean Spears","Britney'Sexy'Spears"这个标题不起作用,那么我的问题是如何在Britney Spears之间插入一个通配符'%'而进行LINQ2SQL搜索?谢谢.
问候,安迪.
Ani*_*Ani 13
您可以将此SqlMethods.Like
方法用于此目的.
from p in Objects
where SqlMethods.Like(p.Title, "Britney% Spears")
select p
Run Code Online (Sandbox Code Playgroud)