How to copy a row from one DataTable to another DataTable?

A

angus

Hi all,

Assume that both DataTable are the same schema, I want to copy a row from
one DataTable to another DataTable by

m_dtItem.Rows.Add(m_dtOrgItem.Rows(0))

However, it said that

Exception Details: System.ArgumentException: This row already belongs to
another table.

So, How can copy a row from one DataTable to another DataTable?

Thank you.
 
S

Shankara Narayanan

Hi -
You have to use the ItemArray to copy the row
m_dtItem.Rows.Add(m_dtOrgItem.Rows(0).ItemArray)

Shankar
11/3/2004 10:36:04 AM
 

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

Top