Compare two datatables and return row index using LINQ


I’m looking for a way how to match two values from datatable 1 with datatable 2 with LINQ.
Two values in a row must match in both the first and second data table. If there was a match for the values in the first table in the second table, I need the column index.
If there was a way to modify a value in the first data table from the second data table upon a match, that would be best.

Currently I’m using this:

(From d1 In dt_1.AsEnumerable
Join d2 In dt_2.AsEnumerable
On d1(“Materialnummer”).toString.Trim Equals d2(“Item Number”).toString.Trim And d1(“LS Nummer”).toString.Trim Equals d2(“Shipper Number”).toString.Trim
Let ra = New Object(){d2(“Remarks”)}
Select dt_Target.rows.Add(ra)).CopyToDataTable

But this expression only gets me the result and not which row to update.

Thanks in advance!

Hi @l.nyari
Refer this post