Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search between two dates in LINQ to Entity?

I have an example in SQL how to use the same logic in Linq to Entity?

SELECT * FROM TABLE WHERE DATE BETWEEN STARTDATE AND ENDDATE  
like image 972
Hrom Avatar asked Apr 29 '10 17:04

Hrom


1 Answers

I'm assuming C#.

DateTime startDate=bla; DateTime endDate=blabla; using(var db=new MyDataContext()) {     var filteredData=db.TABLE.Where(t => t.DATE > startDate && t.DATE < endDate);     //... } 
like image 136
spender Avatar answered Sep 22 '22 13:09

spender