Linq query1

Hi guys ,
i have a data table and in that one column has dates i have to check and copy it to other data table if the date present in the data table is less than the date i mention.

check this code out
Assign this to a Data table type Variable and Than use Write Range to write the data

DT.AsEnumerable.Where(Function(r) If(IsDate(r("ColumnName").ToString.Trim), CDate(r("ColumnName").ToString.Trim) < Today, False) ).CopyToDataTable

Thank you. It WORKS!
can you explain me that code?

In this code we are checking row by row
1st whether its a Date or not If its not a Date then its going to ignore that row,if its a date then it 'll check whether it satisfies our condition or not if it does’not satisfy then it’ll ignore that row and after getting the necessary data it’ll copy data to datatable format

Hope you understood the code
You can learn more about linq and its queries using quick web search or frm this website
LINQ samples in LINQ to Objects


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.