In the source table, if any modification is done the
RowState
of the data row will be
Modified
state. Due to this the RowState of the imported row cannot be set to
Added
state. Hence, you have to first call
AcceptChanges
method on the source table and then import the rows as follows
sourceTable.AcceptChanges();
foreach (DataRow dr in sourceTable.Rows)
{
destinationTable.ImportRow(dr);
destinationTable.Rows(destinationTable.Rows.Count - 1).SetAdded();
}
You may accept and vote one of the solutions which solved your problem, otherwise please post your queries.