我正在研究 LINQ,而 VS2012 在 OrderBy 中对我的 LINQ 语句表示不满:
The name 'x' does not exist in the current context
我想做的是:
SELECT * FROM Contacts
WHERE DateCreated >= [SOMEDATE VALUE]
AND DateCreated <= [SOMEDATE VALUE]
ORDER BY DateCreated DESC
LIMIT 100
LINQ
model.Contacts = db.Contacts.Where((x =>(x.DateCreated >= p.DateFrom) && (x.DateCreated <= p.DateTo))).OrderByDescending(x.DateCreated).Take(100).ToList();
我在这里做错了什么?
谢谢