I have two tables named input1 and input2 with seven columns.
I need to compare each column for all the rows in these tables and update the status as Match and Not match in a Status table.
For this I want to use for each activity of linq query.
Your quick help is appreciated.
Input1- datatable1 read from excel sheet
Input2-datatable2 read from excel sheet
Status table- output table with seven columns
Lets assume the status Table has all columns from dt1 + Status
Prepare Status Table
Assign Activity:
dtStatus = dt1.Clone
Add DataColumn | Name: Status | DataType: String
Assign Activity
dtStatus =
(From d In dt1.AsEnumerable()
Let chk = dt2.AsEnumerable.Any(Function (d2) d2.ItemArray.SequenceEqual(d.ItemArray))
Let sts = If(chk, "Matched", "Not Matched")
Let ra = d.ItemArray.Append(sts).ToArray"Not Match")
Select r = dtStatus.Rows.Add(ra)).CopyToDataTable()