I try to run the next bit of code, but the comparison fails without passing my objects, which I expect.
It compares 06/09/2011 0:00:00 with 06/09/2011 12:25:00 , the last of which is the value of my database. Therefore, why the comparison does not work, and I do not get the necessary records.
I'm just trying to compare if the dates match, I don't care about the time.
DateTime today = DateTime.Now.Date; var newAuctionsResults = repo.FindAllAuctions() .Where(a => a.IsActive == true || a.StartTime.Value == today) .ToList();
How to compare only dates?
If I use the .Date property in the .StartTime.Value part, I get an exception:
The specified member of type 'Date' is not supported in LINQ to Entities. Only initializers, entities, and entity navigation properties are supported.
c # datetime entity-framework-4
Only Bolivian Here
source share