Append data to the already existing dataset?
Hi folks,
I have a dataset(global) which has already got some data in it. After some processing I get the new set of data in a new dataset, and the datatable has go the same structure as the global dataset table. I want to append this new set of data in the global dataset table. i.e if there are already 5 records in the global dataset table and now if there are 3 new records, I want to add these 3 records to the global dataset table so that there are total 8 records in the global dataset table.
Please let me know.
Thanx in advance.
Regards,
Samir.
Re: Append data to the already existing dataset?
If the two DataTables have the same schema you can use the ImportRow method of the target table to copy the contents of each row in the source table to a new row in the target.
VB Code:
For Each row As DataRow In sourceTable.Rows
targetTable.ImportRow(row)
Next row
Re: Append data to the already existing dataset?
Thanx a lot jmcilhinney. I will try it out.
Regards,
Samir.