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

SQL Server 2008 - High Memory Usage

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

Problem In Configuring Biztalk 2009 In Creating A ReceivePort.When I Try To Create A Receive POrt I Got This Error