Linq create a query to get all items from DataTable for specific data range


hi,

i new in linq...i have datatable have table in format of

id,start,end

1,1/1/2013,1/7/2013

2,1/8/2013,1/15/2013

...

i want linq query items falls in specific date rage...

say items between 1/1/2013 1/13/2013 --will give both items in result...as starting after jan-8....

or 1/10/2013 1/13/2013....-- should give 1 item (2) in result..as comes between start , end date....

any appreciated...

thanks

well second case can resolved start , end has correct values filter with.

var rows = table.asenumerable().where(row => row.field<datetime>("start") <= start)                                 .where(row => row.field<datetime>("end") >= end); 



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user