The text of this article is not in this database — only its details are. Read it on the old site: Copying Data from one DataTable to Another using ImportRow
3 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.

Menaka RanathungaPosted Sep 17, 2010, 12:30 AM
Thank you Mahesh Chand, You have given clear explanation and have covered overall requirement regarding this stuff.
Mordechai BendonPosted Nov 23, 2008, 11:40 AM
Dear Mahesh I wanted to copy a single row at a specified position to aanother dt. There are two items: 0 is ID 1 is Description If I use the ImportRow method it creates a new row in the dt but only copies in teh value for item 1 (the description). Item 0 (the ID) is blank!!!! ds.Tables("Prv").ImportRow(ds.Tables("ChooseMenus").Rows(intRow)) When I use the NewRow method and copy over the two items manually then it works fine. rwTemp = ds.Tables("Prv").NewRow rwTemp.Item(0) = ds.Tables("ChooseMenus").Rows(intRow).Item(0) rwTemp.Item(1) = ds.Tables("ChooseMenus").Rows(intRow).Item(1) ds.Tables("Prv").Rows.Add(rwTemp) Why doesn't the ImportRow copy both item values??? Mordechai