copy dataset row

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • suzy

    #1

    copy dataset row

    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.Table s["Order"].Rows.Add (oNewRow);




  • Eliyahu Goldin

    #2
    Re: copy dataset row

    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.Table s["Order"].Rows.Add
    (oDataSet.Table s["Orders"].Rows[0].ItemArray);

    HTH,

    Eliyahu

    "suzy" <phillipa@nospa mming.com> wrote in message
    news:OVEBzSrTDH A.1912@TK2MSFTN GP12.phx.gbl...[color=blue]
    > hi im trying to copy a row from one dataset table to another dataset[/color]
    table.[color=blue]
    >
    > 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.Table s["Order"].Rows.Add (oNewRow);
    >
    >
    >
    >[/color]


    Comment

    • suzy

      #3
      Re: copy dataset row

      hi,

      thanks for that. it seems to be working!


      "Eliyahu Goldin" <removemeegoldi n@monarchmed.co m> wrote in message
      news:OhX3E7rTDH A.304@tk2msftng p13.phx.gbl...[color=blue]
      > This is a known issue. Your oNewRow is just a reference to a row that[/color]
      indeed[color=blue]
      > belongs to another table. Noone took it out of there.
      >
      > Try this:
      >
      > oDataSet2.Table s["Order"].Rows.Add
      > (oDataSet.Table s["Orders"].Rows[0].ItemArray);
      >
      > HTH,
      >
      > Eliyahu
      >
      > "suzy" <phillipa@nospa mming.com> wrote in message
      > news:OVEBzSrTDH A.1912@TK2MSFTN GP12.phx.gbl...[color=green]
      > > hi im trying to copy a row from one dataset table to another dataset[/color]
      > table.[color=green]
      > >
      > > 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.Table s["Order"].Rows.Add (oNewRow);
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...