1

I have two datatables, in one of them old_DataTable I have 3 results. In the other one called Output I have 4 results. I have been implementing solutions suggested in forums:

  1. Read the two Datatables

  2. drCommonRows = (From d1 In old_DataTable.AsEnumerable Join d2 In Output.AsEnumerable On d1("StartDate").toString.Trim Equals d2("StartDate").toString.Trim Select d1).ToList

  3. drFilteredRows=old_DataTable.AsEnumerable.Except(drCommonRows, DataRowComparer.Default).toList

  4. If drFilteredRows.Count >0 than dtFiltered drFilteredRows.CopyToDataTable Else dtFiltered old_DataTable.Clone

When testing it gives a good result of drCommonRows but not of drFilteredRows and in the IF condition it always goes in Else.

I even changed the : drFilteredRows=**old_DataTable**.AsEnumerable.Except(drCommonRows, DataRowComparer.Default).toList

into

drFilteredRows=**Output**.AsEnumerable.Except(drCommonRows, DataRowComparer.Default).toList but in that case it gives as result all the datatable saved in Output so gives 4 results and is not working.


> The result that I am expecting is 1 row that is the one which is
> different and is in the Output Datatable.
kwoxer
  • 3,734
  • 4
  • 40
  • 70
Coding M
  • 11
  • 3
  • Please next time improve the formatting of your text, as it helps many here to be able to give proper help. – kwoxer Jul 11 '22 at 13:24

0 Answers0