Assigning value to a DataRow

S

Shock

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
 
S

Shock

Shock said:
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
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top