我想查詢當(dāng)前時間這個小時內(nèi)的數(shù)據(jù),請問該怎樣查? 我這樣寫報錯。var list= db.user.Where( x =>x.UserName == userName && x.DateTime.ToString("yyyyMMddhhmmss") == DateTime.Now.ToString("yyyyMMddhhmmss")).ToList(); “System.NotSupportedException”類型的異常在 EntityFramework.SqlServer.dll 中發(fā)生,但未在用戶代碼中進行處理其他信息: 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條經(jīng)驗 獲得超4個贊
var list= db.user.Where( x =>x.UserName == userName && x.DateTime >= DateTime.Now.AddHours(-1)).ToList();
- 1 回答
- 0 關(guān)注
- 359 瀏覽
添加回答
舉報
0/150
提交
取消