我想查询当前时间这个小时内的数据,请问该怎样查? 我这样写报错。var list= db.user.Where( x =>x.UserName == userName && x.DateTime.ToString("yyyyMMddhhmmss") == DateTime.Now.ToString("yyyyMMddhhmmss")).ToList(); “System.NotSupportedException”类型的异常在 EntityFramework.SqlServer.dll 中发生,但未在用户代码中进行处理其他信息: LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.
1 回答
缥缈止盈
TA贡献2041条经验 获得超4个赞
var list= db.user.Where( x =>x.UserName == userName && x.DateTime >= DateTime.Now.AddHours(-1)).ToList();
- 1 回答
- 0 关注
- 343 浏览
添加回答
举报
0/150
提交
取消