You can achieve this by just defining the Primary key of targetTable.
Example:
DataTable TargetTable;
DataTable Table1;
// write code to create/fill target table
TargetTable= GetTargetTable();
// define primary key
// for multiple columns
TargetTable.PrimaryKey= new DataColumn[]{TargetTable.Columns[columnName_1],TargetTable.Columns[columnName_2],TargetTable.Columns[columnName_3]};
// for single column
TargetTable.PrimaryKey= new DataColumn[]{TargetTable.Columns[columnName_1]);
Example:
DataTable TargetTable;
DataTable Table1;
// write code to create/fill target table
TargetTable= GetTargetTable();
// define primary key
// for multiple columns
TargetTable.PrimaryKey= new DataColumn[]{TargetTable.Columns[columnName_1],TargetTable.Columns[columnName_2],TargetTable.Columns[columnName_3]};
// for single column
TargetTable.PrimaryKey= new DataColumn[]{TargetTable.Columns[columnName_1]);
// get records�
Table1= GetTable1();
// define primary key
// — same as above
// merge records into TargetTable
TargetTable.Merge(Table1,true);