Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to query a view using a date and am getting the error

"Additional information: The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."

after looking online it was suggested to use the dbfunctions.truncatetime but alas I am still experience the same error, the code I am using is:

VB
Dim items As List(Of vwReceptionKeys) = db.vwReceptionKeys.Where(Function(x) DbFunctions.TruncateTime(x.Arrival_Date) = Now.Date).Take(25).ToList()


Could someone please point me in the correct direction?

Thanks
Posted

1 solution

Solved by storing date post putting it into the query:

VB
Dim today As Date = Now.Date

Dim items As List(Of vwReceptionKeys) = db.vwReceptionKeys.Where(Function(x) x.Arrival_Date > today).Take(25).ToList()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900