Copying a datarow

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am sure this must be REALLY simple, but I've spent the last 2 hours trying
to failing to figure out how to copy a datarow from an existing table to a
new table WITHOUT getting the following error:

Run-time exception thrown : System.ArgumentException - This row already
belongs to another table.

I know the row I want to copy and so my code looks like this:

Dim myTable As New DataTable
Dim myDataRow As Data.DataRow = dsProjectsGroup.Tables("Projects").Rows(i)
myTable.Rows.Add(myDataRow)

any ideas what I am doing wrong?
 
Back
Top