Linq except function query

Hi Team,

I am comparing two dt using except function and returns rows if dt1 rows not available in dt2 rows

dt1.AsEnumerable.Except(dt2.AsEnumerable(), system.Data.DataRowComparer.Default).CopyToDataTable

it gives expected result if dt1 data is not in dt2 but i have only one row both in dt1 and dt2 then the above query does not work and getting error source does not contain any rows.

Could you please help how to avoid this error?

Thanks,
Ula

2 Likes