Browsed by
Tag: compare datatables

Compare two DataTables for differences in C#? [duplicate]

Compare two DataTables for differences in C#? [duplicate]

You could use LINQ to join the two DataTable objects, matching every column. Then take the IQueryable and find all the rows in the first two DataTable objects which are not in the IQueryable. Example:

The code above should work, though I did not test it. You could also check out LINQ query on a DataTable which has some useful information on using LINQ with DataTables. I also find the LINQ samples to be helpful when writting LINQ.