I have two datatables that I am comparing. As soon as a value is missing, it should be written as a whole row in the other table. The problem is that I get all rows written into the table and not only the corresponding one that is different. How can I achieve this?
Alright, could you try adding a Breakpoint at the Add DataRow Activity just to get an idea of how the logic is currently flowing and to pinpoint the potential cause of error?
If you can provide us with some sample data, that would put us in a much better position to assist you.
(From row1 In dt1.AsEnumerable()
Group Join row2 In dt2.AsEnumerable()
On row1(str_columnNameDt1).ToString.Trim Equals row2(str_columnNameDt2).ToString.Trim Into gj = Group
From g In gj.DefaultIfEmpty
Where IsNothing(g)
Select row1).CopyToDataTable()
You could try playing around with the conditions in this snippet of code
(From row1 In dt1.AsEnumerable()
Group Join row2 In dt2.AsEnumerable()
On row1(str_columnNameDt1).ToString.Trim Equals row2(str_columnNameDt2).ToString.Trim Into gj = Group
From g In gj.DefaultIfEmpty
Where Not IsNothing(g)
Select row1).CopyToDataTable()
Also I’ve made a slight error, please rectify that and see if it works as expected: