So I am using a linq query to update column values that match after comparing 2 columns, but it is giving error : “rowSheet2 cannot be used in lambda expression” Below is the query I am using. Can someone please help resolving it?
For Each rowSheet2 In dt2.Rows
Dim matchingRows = dt1.AsEnumerable().Where(Function(row) row(“REPORTING_PAYROLL”).ToString = rowSheet2(“MasterTax”).ToString).ToList()
If matchingRows.Count > 0 Then
’ Match found, update values in dtSheet1
matchingRows(0)(“Company: Short Name”) = rowSheet2(“Company: Short Name”)
matchingRows(0)(“Company: Name”) = rowSheet2(“Company: Name”)
Else
’ No match found, add a new row to dtSheet3
dt3.Rows.Add(rowSheet2.ItemArray)
End If
Next

