Assumptions:
- take A Col Values when Col is not present in B
- A and B DataTables have same row count
So we can implement a dynamic conditional side by side merge
Calculate the cols not present in B:
prepare dt 3 and add missing cols /transfer also other col settings e.g. datatype
Merge rows:
(From i In Enumerable.Range(0,dt2.Rows.Count)
Let raB = dt2.Rows(i).ItemArray
Let raA = arrMissingCols.Select(Function (x) dt1.Rows(i)(x)).toArray
Let ra = raB.Concat(raA).ToArray
Select dt3.Rows.Add(ra)).CopyToDataTable
find starter help here:
MergeTables_TakeAColIfNotInB.xaml (12.6 KB)