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();

posted @ 2010-07-08 15:57  肚肚  阅读(4492)  评论(3编辑  收藏  举报