Tag Archives: dhl Error

[Solved] dhl: Error: LINQ to Entities does not support the specified type member “Date”

Linq such as:

            var v = from l in _dal.Share where l.PingcoId == pingcoId && (l.CreateTime.Date == DateTime.Now.Date) select l;
            return v.ToList();

An error will be reported: LINQ to Entities does not support the specified type member “Date”.

 

Change to this 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();