I need to check dt1 datatable value on the bases of columns if any cell is null or empty. it has to pick the value from dt2 on based.
Both dt1 and dt2 having unique columns Name.
i got the error on below code… i dont know to fix it.
(from i in Enumerable.Range(0, {dtData1.Rows.Count, dtData2.Rows.Count}.Min())
let r1 = dtData1.Rows(i)
let r2 = dtData2.Rows(i)
let arrNames = dtData1.Columns.Cast(Of DataColumn).Select(function (c) c.ColumnName).toArray
let ra = arrNames.Select(function (x) if (dtData2.Columns.Contains(x), r2(x), r1(x))).toArray
Group Join dtData2 in dtData2.AsEnumerable on dtData1(0) Equals dtData2(0) into gp=Group
from g in gp.DefaultIfEmpty
Select ra = new object () {}
Select dtResult.Rows.Add(ra)).CopyToDataTable()
A few questions left but give a try on followoing:
Assign Activity
dtResult = dtInput.Clone
Assign Activity
dtResult =
(From d1 In dtInput.AsEnumerable
Where d1.ItemArray.Any(Function (x) isNothing(x) OrElse String.IsNullOrEmpty(x.toString.Trim))
Let d2m = dtAllDetails.AsEnumerable.Where(Function (d2) d1(0).toString.Trim.Equals(d2(0).toString.Trim)).FirstOrDefault
Where Not isNothing(d2m)
Let ra = d2m.ItemArray
Select r = dtResult.Rows.Add(ra)).CopyToDataTable
when dInput has blanks we will take dMaster when it was found