Last post Aug 10, 2018 12:17 PM by markfitzme
Aug 10, 2018 09:16 AM|Mahesh420|LINK
I have Dt1----> 32432 rows
Dt2 ------>24239 rows. Have column name Account in both tables
var duplicateRecords = (from r1 in Dt1.AsEnumerable()
join r2 in Dt2 .AsEnumerable() on r1.Field<string>("Account ") equals r2.Field<string>("Account
Surprisingly duplicateRecords returns 24247 rows which are more than no of rows in Dt2. How is it even possible? What is going wrong here
When i try to delete duplicate records i am getting The given Datarow is not in the current DataRowCollection exception.
Aug 10, 2018 12:17 PM|markfitzme|LINK
The number could be larger if there are duplicates in Dt1. So if there are 2 records in DT1 that are duplicated and there are two rows in DT2 that have the same value you end up with both sets of matches, which end up with 4 as each row in DT1 that is a
duplicate matches to all the duplicates in Dt2.
In the case where duplicates in Dt1 occur you can have duplicates in your duplicate list. So it can easily be that the first one removes and the second one explodes. You could try throwing a Distinct() prior to the .ToList() to ensure your duplicate records
doesn't have duplicate records.