查询我有以下查询过滤按日期
var query =
from f in _db.Production
join g in _db.Run on f.show equals g.Production.show
select new ViewProductions {
Venuename = g.venue,
Showname = f.show,
StartDate = g.startDate,
EndDate = g.endDate
};
return View(query);
如何将添加一个WHERE子句会说
哪里开始日期是从今天起未来3个月?
感谢
更新
工作代码再次
var now = DateTime.UtcNow;
var limit = now.AddDays(90);
var query =
from f in _db.Production
join g in _db.Run on f.show equals g.Production.show
where g.endDate >= now && g.startDate <= limit
select new ViewProductions
{
Venuename = g.venue,
Showname = f.show,
StartDate = g.startDate,
EndDate = g.endDate
};
return View(query);
感谢您的帮助。
这没有输出任何数据 – 2011-04-03 23:05:20
好,我猜不出你的模式。 – Femaref 2011-04-03 23:10:40
感谢您的代码。我现在正在工作,只需要切换日期。我已更新我的问题以包含正确的代码。 – 2011-04-04 10:09:52