In my Entity (Sale) has a type of DateTime
column Date
.
I used following lambda expression to get the latest TrNo
from that table. But always it gives me Null
. Because it also compares the Time
part of the column. Actually I wanted to compare the Date
part of the column.
db.Sales.OrderByDescending(O => O.Date).Where(O => O.Date == DateTime.Now ).Select(O => O.TrNo).FirstOrDefault();
Please help me to get the build the right code. (My db is MySQL)
Thanks!