var res = from n in db.News where (n.CreateTime-DateTime.Now).TotalDays >0 select n; ViewBag.news = res.ToList<News>();
提示
行 17: var res = from n in db.News where ((n.CreateTime-DateTime.Now).TotalDays
行 18: >0) select n;
行 19: ViewBag.news = res.ToList<News>();
行 20: return View();
行 21: }
|
类型不对,检查一下类型
例子:db.Entity1Set.Where(x => System.Data.Objects.EntityFunctions.DiffDays(DateTime.Now, x.date) > -10).ToList().ForEach(x => Console.WriteLine(x.Id)); //间隔小于10天
关键字 System.Data.Objects.EntityFunctions