我第一次尝试比较DateTime
var searchResult = new PagedData<SAMPLE_STOCK>
{
Data = _db.SAMPLE_STOCK.Where(m => m.LAST_UPDATED.Date == lastUpdate.Date)
};
return PartialView(searcReasult);
它给出了以下错误
The specified type member 'Date' is not supported in LINQ to
Entities. Only initializers, entity members, and entity navigation
properties are supported.
然后我写下面的代码
var searchResult = new PagedData<SAMPLE_STOCK>
{
Data = _db.SAMPLE_STOCK.Where(m => m.LAST_UPDATED.Day == lastUpdate.Day
&& m.LAST_UPDATED.Month == lastUpdate.Month
&& m.LAST_UPDATED.Year==lastUpdate.Year)
};
它工作正常。我的问题是....这些有什么区别?