如何使用查询获取今天的约会活动

时间:2018-11-09 11:28:35

标签: c# sql-server entity-framework linq

  TodayCheckedStatus = (from checkinout in context.Checkinout
                        join status in context.Status on checkinout.CheckType equals status.Statusid
                        where checkinout.Userid == userinfo.Userid
                        where checkinout.CheckTime == DateTime.Today.Date       
                        orderby checkinout.CheckTime descending
                        select new Checkinout
                        {
                         CheckStatus = status.StatusText,
                         CheckTime = checkinout.CheckTime
                         }).ToList()

我使用了它,但是由于不起作用,它在页面中什么也没显示

          where checkinout.CheckTime == DateTime.Today.Date 

1 个答案:

答案 0 :(得分:0)

只需重申@ikerbera的回答,所需的更改就是

where checkinout.CheckTime.Date == DateTime.Today.Date