刚用linq两天,基本语法还不太懂,
EntityQuery<FriendInfo_tbl> query = from f in service.GetFriendInfo_tblQuery() where f.personalGroupID == pg.personalGroupID && (f.xing.IndexOf(tbSo.Text) != -1 || f.ming.IndexOf(tbSo.Text) != -1 || f.cellphoneNum.IndexOf(tbSo.Text) != -1 || (tbSo.Text.StartsWith(f.xing) && tbSo.Text.EndsWith(f.ming))) select f;
有什么办法能让f.personalGroupID 检索pg.personalGroupID ,功能相当于sql里用in实现的结果一样
求高手解决 - -,
in 操作
描述:查询指定城市中的客户
查询句法:
var in操作 = from c in ctx.Customers where new string[] { "Brandenburg", "Cowes", "Stavern" }.Contains(c.City) select c; |
如果用扩展方法,contains,
用语句的话类似这样:
var query= from f in service.GetFriendInfo_tblQuery()
where f.personalGroupID.Contains(pg.personalGroupID)
...
select f;