copy dataset row

  • Thread starter Thread starter suzy
  • Start date Start date
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);
 
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
 
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);
 
Back
Top