I hope someone could help me with this issue I am having. 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 the solution that was suggested in the forum :
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
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 goes always in Else.
I even changed the : drFilteredRows=**old_DataTable**.AsEnumerable.Except(drCommonRows, DataRowComparer.Default).toList
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.
```Any idea please?
**The result that I am expecting is 1 row that is the one which is different and is in the Output Datatable.**
and the old_DataTable has 3 results so I dont understand why it says null. If I do instead of old_DataTAble the second Datatable the one that has 4 results called Output Output.AsEnumerable.Except(dt_CommonRows.AsEnumerable(), DataRowComparer.Default).CopyToDataTable
it gives me all the result the 4 results of Output, I need only the one that is different.
Already tried all what said and still no result. Have tried many ways and options. Recently using this code drNonDuplicates=dtMaster.AsEnumerable().Union(dtData.AsEnumerable().Except(dtMaster.AsEnumerable(), DataRowComparer.Default)).ToList()
This is My Master result from test 10 till test 19
Peter finally it is working, You know what I did: I used your solution FindDupsNonDupsByAllCols.xaml just with this little modification and Now I have the result I wanned.
dtMaster.AsEnumerable().Except(dtData.AsEnumerable(), DataRowComparer.Default).Union(dtData.AsEnumerable().Except(dtMaster.AsEnumerable(), DataRowComparer.Default)).ToList()
Thank you a lot to everyone for the help.