dhl:报错:LINQ to Entities 不支持指定的类型成员“Date”
Linq如:
var v = from l in _dal.Share where l.PingcoId == pingcoId && (l.CreateTime.Date == DateTime.Now.Date) select l;
return v.ToList();
会报错:LINQ to Entities 不支持指定的类型成员“Date”。
改成这样OK:
DateTime sdt = DateTime.Now.Date;
DateTime dt = DateTime.Now.Date.AddDays(1);
var v = from l in _dal.Share where l.PingcoId == pingcoId && (l.CreateTime >= sdt && l.CreateTime <= dt) select l;
return v.ToList();