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

  • Thread starter Thread starter angus
  • Start date Start date
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.
 
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
 
Back
Top