您将DateTime
数据库中的值与其值进行比较,该值DateTime.Now
将返回当前时间(包括毫秒),并且永远不会与表中的任何值匹配。
修改查询以选择范围内的值
var minDate = DateTime.Today; // returns today's with time component set to 00:00:00
var maxDate = minDate.AddDays(1);
ViewBag.TrafficEnter = _iTrafficRepository.Get()
.Where(i => i.Type == "ورود" && i.SubmitDateTime >= minDate && i.SubmitDateTime < maxDate).ToList();
假设今天的日期是2016年5月24日,它将返回图像中显示的所有17条记录。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句