Assigning value to a DataRow

Discussion in 'ASP .Net' started by Shock, Apr 12, 2004.

  1. Shock

    Shock Guest

    Anybody ever tried to assign certain values in one datarow to certain
    locations in another datarow?

    Here is my code to this pont. Followed by the output from the command
    window in vs.net debugging mode.

    targetRow[0].BeginEdit();

    targetRow[0].ItemArray[grwFSAIndex] = dr.ItemArray[fsaIndex];

    targetRow[0].ItemArray[grwFSAFieldIndex] = dr.ItemArray[fsaFieldIndex];

    targetRow[0].ItemArray[grwFSATractIndex] = dr.ItemArray[fsaTractIndex];

    targetRow[0].EndEdit();



    Output:

    dr.ItemArray

    {Length=6}

    [0]: "83"

    [1]: "91667"

    [2]: "1234"

    [3]: "56"

    [4]: "7"

    [5]: "4"



    targetRow[0].ItemArray

    {Length=12}

    [0]: "Name"

    [1]: {83}

    [2]: "Other Name"

    [3]: "The name"

    [4]: {14544}

    [5]: {91667}

    [6]: "WY"

    [7]: "Vincent"

    [8]: {4.78}

    [9]: ""

    [10]: ""

    [11]: ""



    As you can see, after the assignment the columns 9 to 11 on targetRow should
    be set to the values 2 to 4 on dr. The column variable numbers are correct
    in my code, but for some reason I cannot get the values to be assigned.

    Thanks ahead,

    Shock
    Shock, Apr 12, 2004
    #1
    1. Advertising

  2. Shock

    Shock Guest

    "Shock" <> wrote in message
    news:...
    > Anybody ever tried to assign certain values in one datarow to certain
    > locations in another datarow?
    >
    > Here is my code to this pont. Followed by the output from the command
    > window in vs.net debugging mode.
    >
    > targetRow[0].BeginEdit();
    >
    > targetRow[0].ItemArray[grwFSAIndex] = dr.ItemArray[fsaIndex];
    >
    > targetRow[0].ItemArray[grwFSAFieldIndex] = dr.ItemArray[fsaFieldIndex];
    >
    > targetRow[0].ItemArray[grwFSATractIndex] = dr.ItemArray[fsaTractIndex];
    >
    > targetRow[0].EndEdit();
    >
    >
    >
    > Output:
    >
    > dr.ItemArray
    >
    > {Length=6}
    >
    > [0]: "83"
    >
    > [1]: "91667"
    >
    > [2]: "1234"
    >
    > [3]: "56"
    >
    > [4]: "7"
    >
    > [5]: "4"
    >
    >
    >
    > targetRow[0].ItemArray
    >
    > {Length=12}
    >
    > [0]: "Name"
    >
    > [1]: {83}
    >
    > [2]: "Other Name"
    >
    > [3]: "The name"
    >
    > [4]: {14544}
    >
    > [5]: {91667}
    >
    > [6]: "WY"
    >
    > [7]: "Vincent"
    >
    > [8]: {4.78}
    >
    > [9]: ""
    >
    > [10]: ""
    >
    > [11]: ""
    >
    >
    >
    > As you can see, after the assignment the columns 9 to 11 on targetRow

    should
    > be set to the values 2 to 4 on dr. The column variable numbers are

    correct
    > in my code, but for some reason I cannot get the values to be assigned.
    >
    > Thanks ahead,
    >
    > Shock
    >
    >

    Awww. I am bummed, nobody can help me. LOL.

    Shock
    Shock, Apr 13, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chet
    Replies:
    3
    Views:
    149,655
  2. Ali M
    Replies:
    2
    Views:
    6,707
    Ali M
    Feb 15, 2005
  3. RSH
    Replies:
    2
    Views:
    2,264
  4. orenl
    Replies:
    1
    Views:
    636
    Eliyahu Goldin
    Dec 4, 2006
  5. weston
    Replies:
    1
    Views:
    249
    Richard Cornford
    Sep 22, 2006
Loading...

Share This Page