How to use BETWEEN keyword in LINQ (Eentity-framework)

Posted on

To search between two date ranges in your LINQ for Entity Framework, you can use >= and <= with DateTime to get values between given range.

For Example:

DBEntities db = new DBEntities();
var ml = db.Orders.SingleOrDefault(p => p.OrderStatus == “Urgent”
&& p.OrderDate <= yourDate
&& p.OrderDate >= yourDate);

Hope this will help.

Leave a Reply

Your email address will not be published. Required fields are marked *