Filtering data table by using a LINQ query's

Hi @killarapusiva ,

// Assuming dt is your DataTable
var filteredRows = from row in dt.AsEnumerable()
where row.Field(“Status”) == “Completed” &&
row.Field(“Priority”) > 3
select row;

// Convert the result to a new DataTable or use further processing
DataTable resultDataTable = filteredRows.CopyToDataTable();

This LINQ query selects rows from the DataTable where the “Status” column is “Completed” and the “Priority” column is greater than 3. The CopyToDataTable() method is then used to convert the result into a new DataTable.

Happy Automation

1 Like