dky1e
July 18th, 2002, 12:16 PM
foreach( DataRow row1 in myTable.Rows )
{
DataRow row2= ds.Tables["myTable2"].NewRow();
//do stuff to the row2, update it with data from row1
ds.Tables["myTable2"].ImportRow( row );
ds.AcceptChanges();
}
This code only adds one row to the "myTable2", even though there are multiple rows in myTable, and the program cycles thorugh the loop multiple times.
What's the problem?
{
DataRow row2= ds.Tables["myTable2"].NewRow();
//do stuff to the row2, update it with data from row1
ds.Tables["myTable2"].ImportRow( row );
ds.AcceptChanges();
}
This code only adds one row to the "myTable2", even though there are multiple rows in myTable, and the program cycles thorugh the loop multiple times.
What's the problem?