Click here to Skip to main content
15,918,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to compare two datatables and get unmatched records without using loop?
Thanks In advance
Posted
Comments
Kornfeld Eliyahu Peter 30-Jan-14 2:50am    
Try SQL...

1 solution

There is no real way to compare any two lists without a loop: even Linq uses a loop, though it is hidden from direct sight.

Strictly speaking, this will return rows that are unique to one DT:
C#
var dif1 = dt1.AsEnumerable().Except(dt2.AsEnumerable());

But...it probably isn't any real use to you, because it directly compare the rows, and that doesn't mean that the row contents are different, just that they are the same rows.

Probably what you are really going to want to do is decide what element of the row makes it "unique" and do a comparison based on that column in each table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900