Need linq for below logic

Hi team,
I need linq for below logic,

I have two data tables we need to get data from second data table. In primary data table we have ID and need to check in dt2 if it is match means pick the data and store in out put

Please find attachment below for more info

Thanks,
Vicky

We can handle it as a Lookup task

Essential modelling:

  • DataTable lookup + outfiltering the non-present ones
    OR
  • Join Datatable (Inner join) + post result

With LINQ we can do:

  • Build DataTable - Configure the 3 cols, ID, NAME, STATUS - dtResult

Assign Activity:
dtResult =

(From d1 in dt1.AsEnumerable
Join d2 in dt2.AsEnumerable
On d1("ID").toString.Trim Equals d2("ID").toString.Trim
Let ra = new Object(){d1(0), d1(1), d2("Status")}
Select r = dtResult.Rows.Add(ra)).CopyToDataTable

Handling empty result:

That’s called a join, it’s a standard database operation. You should use the Join Data Table activity, you don’t need linq.