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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top