appending rows to datatable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

This is the way to append the rows from one datatable into another with the
same schema.

Here Temp and Temp1 are the datatables

For Each rows As DataRow In tempTable.Rows
Temp1 .NewRow()
Temp1 .ImportRow(rows)
Next

-Vignesh.S
 
check out ItemArray on the DataRow class

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatarowclassitemarraytopic.asp

something like:

foreach(Datarow row in Table1.Rows)
{
DataRow newRow = Table2.NewRow();
newRow.ItemArray = row.ItemArray;
}

--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.
 
should have been

foreach(Datarow row in Table1.Rows)
{
DataRow newRow = Table2.NewRow();
newRow.ItemArray = row.ItemArray;

Table2.Rows.Add(newRow);
}

Ollie Riches
 
Back
Top