|
-
July 18th, 2002, 12:16 PM
#1
DataTable probelm, can't add new rows.
Code:
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?
-
July 18th, 2002, 01:59 PM
#2
Hi,
I have used "ds.Rows.Add(newRow)" .
I haven't used Import Row function, and I am no sure why it did not work.
-
July 30th, 2002, 02:00 AM
#3
shouldn't be there ImportRow ( row2 ) instead of ImportRow ( row )
Last edited by franc2; July 30th, 2002 at 08:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|