我在嘗試從MVC實體框架中的MS SQL數據庫查詢日期範圍時收到錯誤。日期範圍查詢中的SQL/Entity Framework錯誤
Unable to cast the type 'System.Boolean' to type 'System.Data.SqlTypes.SqlBoolean'. LINQ to Entities only supports casting Entity Data Model primitive types.
這是我們的查詢:
dbWS.Where(Function(x) x.CountyCode = user.County And x.CompleteStatus.Contains("0") And x.ProgramEffort = 25 And
x.combinedDate> = prevDate而x.combinedDate < =明天)
大膽的代碼導致此錯誤。我們正在以不同的方式查詢這個問題,並且它工作正常,但是由於我們必須更改爲日期範圍,因此我們一直在收到此錯誤。