var query=from x in db.usrs
where new string[]{"apple","ear","bana"}.Contains(x.Name)
select x;
转换成sql就是
select * from users where name in ('apple','ear','bana')
------解决方案-------------------- var query=from x in db.users
where new string[]{"apple","ear","bana"}.Any(y => x.Name.Contains(y))
select x;
------解决方案--------------------
--模湖查询
select *
from tb
where CHARINDEX('apple',COL)>0 or CHARINDEX('pear',COL)>0 or CHARINDEX('banana',COL)>0
或者
select *
from tb
where COL like '%apple%' or COL like '%pear%' or COL like '%banana%'
------解决方案--------------------
怎么可能报错。 ------解决方案--------------------
--模湖查询
select *
from tb
where CHARINDEX('apple',COL)>0 or CHARINDEX('pear',COL)>0 or CHARINDEX('banana',COL)>0
或者
select *
from tb
where COL like '%apple%' or COL like '%pear%' or COL like '%banana%'