在SQL Server中,我们可以发出SQL得到像对于SQL Server 2008来说SQL和Soudex的linq查询是什么?
select * from table where column like '%myword%'
select * from person where Soundex(LastName) = Soundex('Ann')
什么LINQ查询匹配上面的SQL数据?
在SQL Server中,我们可以发出SQL得到像对于SQL Server 2008来说SQL和Soudex的linq查询是什么?
select * from table where column like '%myword%'
select * from person where Soundex(LastName) = Soundex('Ann')
什么LINQ查询匹配上面的SQL数据?
from t in table
where t.column.Contains("myword")
select t
在.NET 4.0中,你可以使用SoundCode功能,可能是这样的:
from p in person
where SqlFunctions.SoundCode(p.LastName) == SqlFunctions.SoundCode('Ann')
select p
谢谢。正如信息所说:你不能直接调用这个函数。该函数只能出现在LINQ to Entities查询中。我使用实体框架作为DAL。那么如何将它写入INQ到实体查询?说q是EntityQuery,查询应该像q = q.Where(p => p.LastName.Soundex()== someword);?但我做不到。 –
KentZhou
2009-10-13 17:40:13
如果我是你,我可能会创建一个存储过程来做到这一点。我不知道另一种方式。 – 2009-10-13 18:12:52