Linq Query - datatable

Hi Team,
I have a master datatable and i have a smaller datatable. I want to extract from the master datable after matching “PAN” column from both the datatables. If the “PAN” of the master datatable is present in the smaller datatable then i will take that row of master datatable and store it in another datatable. I want to do this using LINQ query. Please help team. It is urgent.

Thanks.

Hi,

Can you try the following?

arDR=dtMaster.AsEnumerable.Where(Function(r) dtSmall.AsEnumerable.Any(Function(r2) r("PAN").ToString=r2("PAN").ToString)).ToArray

then

dtNew = arDR.CopyToDataTable()

Sample20230211-1L.zip (3.1 KB)

Regards,

Use the Join Datatable activity. What you’re trying to do is called a join. It’s a standard database operation.

1 Like