copy dataset row

S

suzy

hi im trying to copy a row from one dataset table to another dataset table.

i tried the following but it says the row belongs to another table. any
idea what im doing wrong, or if its possible?

//both datasets have been initiablised earlier

DataRow oNewRow = oDataSet.Tables["Orders"].Rows[0];

oDataSet2.Tables["Order"].Rows.Add (oNewRow);
 
E

Eliyahu Goldin

This is a known issue. Your oNewRow is just a reference to a row that indeed
belongs to another table. Noone took it out of there.

Try this:

oDataSet2.Tables["Order"].Rows.Add
(oDataSet.Tables["Orders"].Rows[0].ItemArray);

HTH,

Eliyahu
 
S

suzy

hi,

thanks for that. it seems to be working!


Eliyahu Goldin said:
This is a known issue. Your oNewRow is just a reference to a row that indeed
belongs to another table. Noone took it out of there.

Try this:

oDataSet2.Tables["Order"].Rows.Add
(oDataSet.Tables["Orders"].Rows[0].ItemArray);

HTH,

Eliyahu

suzy said:
hi im trying to copy a row from one dataset table to another dataset table.

i tried the following but it says the row belongs to another table. any
idea what im doing wrong, or if its possible?

//both datasets have been initiablised earlier

DataRow oNewRow = oDataSet.Tables["Orders"].Rows[0];

oDataSet2.Tables["Order"].Rows.Add (oNewRow);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top