[英]LINQ query including an array of long type data
I have a Ling query and in this query I want to fetch data according to data in an array ( PrdIdArr
). 我有一个Ling查询,在此查询中,我想根据数组( PrdIdArr
)中的数据获取数据。
In the 6th line u.START_PRD_ID
should be matched with data in the array ( PrdIdArr
) but I could not 在第六行中, u.START_PRD_ID
应该与数组中的数据( PrdIdArr
)匹配,但是我不能
var mainQuery = (from o in db.OPERATIONs
join u in db.UNITs on o.OP_UNIT_ID equals u.UNIT_ID
join x in db.XIDs on u.UNIT_ID equals x.UNIT_ID
where o.OP_OT_CODE == OtCode
where x.IDTYP_CD == "BSN"
**where u.START_PRD_ID == PrdIdArr[0]**
where u.START_PRD_ID == new List<long>(PrdIdArr.Any<long>)
select new
{
...
}).Take(_RowNumber);
var result = mainQuery.ToList();
data = this.Json(result);
data.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
return data;
I could not make the correct way of matching the data of a field ( u.START_PRD_ID
) with each data in an array ( PrdIdArr
)! 我无法通过正确的方式将字段( u.START_PRD_ID
)的数据与数组( PrdIdArr
)中的每个数据进行PrdIdArr
!
Can anyone help me, please??? 谁能帮我吗?
if you want to wish to get those fields that contain in both the query and array, use intercept? 如果您希望获取包含在查询和数组中的字段,请使用拦截?
var c = a.Intersect(b);
However, the above will remove the duplicates field. 但是,以上内容将删除重复项字段。
you could also use contains 您也可以使用包含
b.Contains(a)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.