copy a single row from one datatable to other

ado.net, asp.net, c#, datarow, datatable

Solution

Use

newtable.ImportRow(oldtable.Rows[i]) 

where `i` is the desired row number.

as explained in http://support.microsoft.com/kb/308909/en-us

Problem

I have two datatables one has few rows other is empty. I am running a loop over first one to copy some of the rows to another table. I am getting error 'The row already belongs to another table'. Is there any way to copy DataRows one by one to other DataTable. thanks in advance

Original source