Comparing two data tables

Hi Ananthu,

You can use the DataTable.Rows.Contains method to check if the table already contains a row with same data. The check is done comparing the values in the columns set as Primary Key. So, first we need to set the primary key to the columns we want to use for check.

See attached example on how to use the DataTable.PrimaryKey property and DataTable.Rows.Contains method.
CheckDuplicates.xlsx (8.5 KB)
CheckDuplicates.xaml (10.9 KB)

Regards
Silviu

4 Likes