Difference of two Data Tables in LinQ

By [)ia6l0 iii

Use LinQ's Except extension on DataTable to find out the Difference between two DataTables.

Sample code snippet as below:

Dim tableOneData = dataset.Tables(1).AsEnumerable()
Dim tableTwoData = dataset.Tables(2).AsEnumerable()

Dim exceptRowCollection  = tableTwoData.Except(tableOneData)

The exceptRowCollection is an Enumerable DataRow Collection which is the difference between the two datatables.

Difference of two Data Tables in LinQ  (1983 Views)