【发布时间】:2010-04-01 01:04:19
【问题描述】:
我需要做以下事情:
var a = from c in DB.Customers
where (from t1 in DB.Table1 where t1.Date >= DataTime.Now
select t1.ID).Contains(c.ID) &&
(from t2 in DB.Table2 where t2.Date >= DataTime.Now
select t2.ID).Contains(c.ID)
select c
它不想运行。我收到以下错误:
超时。超时时间 在完成之前经过 操作或服务器不 回应。
但是当我尝试运行时:
var a = from c in DB.Customers
where (from t1 in DB.Table1 where t1.Date >= DataTime.Now
select t1.ID).Contains(c.ID)
select c
或者:
var a = from c in DB.Customers
where (from t2 in DB.Table2 where t2.Date >= DataTime.Now
select t2.ID).Contains(c.ID)
select c
有效!我确信这两个 IN 查询都包含一些客户 ID。
【问题讨论】:
标签: asp.net-mvc linq linq-to-sql