Accepted answer

you have to filter between a start and end date if you want to make use of whatever indexes you might have on depositdate. if you do not care about that there are canonical date functions you can use to strip the time from the database value.

datetime today =;
datetime tomorrow = today.adddays(1);

var deposit = (from u in db.deposit
               where u.depositdate >= today && u.depositdate < tomorrow
               select u).tolist();

or as a lambda

var deposits = db.deposit
                .where(u => u.depositdate >= today && u.depositdate < tomorrow)

as a side note and also a matter of opinion it generally recommended to pluralize dbset<t> properties on your dbcontext (like db.deposits). the same goes for your variable deposit as it will be of type list<deposit> which is a collection (the 2nd code sample i changed it).

Related Query

More Query from same tag