How to filters rows in data table using LINQ query

Hi Team,

I want to filter rows using LINQ query … Can someone please help me in this ?

I have table like below

I want filter rows only rows which is having “HSM” value in accounts column… I tried filter data table activity but it is taking too much time and failing sometime since I have lakhs of records in my excel. So want to try using LINQ query



Hi @Mandava_Naresh

You can try this

dt_Data=dt_Data.AsEnumerable().Where(Function (row) row("Accounts").ToString.ToUpper.Trim.Equals("HSM")).CopyToDataTable

Hi @Mandava_Naresh

How about this expression

Dt.AsEnumerable.Where(Function(r) r.Item("Account").ToString.Equals("HSM")).CopyToDataTable


LINQ isn’t any faster. It’s a myth. LINQ has to loop, too.

This is working … Thank You very much @Gokul001

Thank you @kumar.varun2

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