When using EF, in the limda expression (query. Where (x = > x.CheckInDate >= bd.Date);) This exception is thrown when querying. The discovery found on the Internet can not solve the problem
Later, in http://sandeep-tada.blogspot.com/2014/02/the-specified-type-member-date-is-not.html It is found in that the datetime member date is not allowed in the original LINQ
To avoid this, there are two solutions:
1、 After assigning bd.date to LINQ, pass it in:
var bdDay = bd.Date;
query.Where(x => x.CheckInDate >= bdDay);
2、 Use the dbfunctions function method to escape
query.Where(x => x.CheckInDate >= DbFunctions.TruncateTime(bd.Date));
Similar Posts:
- Oracle ORA-00936: missing expression [How to Solve]
- C++ Error: passing ” “as” ” discards qualifiers
- ValueError: day is out of range for month [How to Solve]
- ValueError: day is out of range for month [How to Solve]
- Day 1 – meet Tornado
- [Solved] java.lang.IllegalArgumentException: Cannot format given Object as a Date
- Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions
- TypeError: Object of type ‘datetime‘ is not JSON serializable [Solved]
- Error in compiling APR util for Linux
- Iview requested an error solution after clearing the Date-picker component