Hi,
Take a look at Cor's examples again:
DataSet.Tables[0].Rows[0][1] = "String";
or
DataSet.Tables[0].Rows[0].ItemArray = new Object[]
Now, take a look at one of yours:
ReturnValue.Tables[0].Rows[count].ItemArray[12] = "Contact
Customer Service";
Do you see the difference?
Cor's first example is indexing into the rows to get the row at index
zero. Then, it's indexing into that row's columns to get the column at
index 1 and is assigning the value to that column. In his second
example, he's setting the entire ItemArray property to a new object array
(almost. It should be something like: new object[] { "col 1", "col 2" }).
In your example, you're indexing into the object[] returned by the
ItemArray property and setting element 12 to be "Contact Customer
Service". Since ItemArray is returning a copy of the items in the
DataRow, your code is just updating the copy. You should be doing one of
the following instead:
ReturnValue.Tables[0].Rows[count][12] = "col 12 value";
or
ReturnValue.Tables[0].Rows[count].ItemArray =
new object[] { col1, col2, col3... "col 12 value", ...};
Obviously, the first approach is much simpler in your case
--
Dave Sexton
samoore said:
Cor
I do that, or at least I think I do that. I have put my code below to
show what I am doing.
switch(spReturn.Trim())
{
case "PROBLEM: CSONO NOT IN RB":
ReturnValue.Tables[0].Rows[count].ItemArray[12] = "Contact
Customer Service";
break;
case "Being Picked":
ReturnValue.Tables[0].Rows[count].ItemArray[12] = "Being
Picked";
break;
case "Can Cancel":
ReturnValue.Tables[0].Rows[count].ItemArray[12] = "Item Can
Not Be Cancelled";
break;
case "TRACKING NUMBER":
ReturnValue.Tables[0].Rows[count].ItemArray[12] = "Being
Picked";
break;
}
When I check the DataSet to see if there are any changes or if the
rowstate has chaned, neither have changed. I am apparently missing
something, just not sure what???
Scott Moore
Cor Ligthert [MVP] wrote:
Dave
Is a little bit cryptic today
DataSet.Tables[0].Rows[0][1] = "String";
or
DataSet.Tables[0].Rows[0].ItemArray = new Object[]
{........................};
Cor
"samoore" <
[email protected]> schreef in bericht
I have found two or three places where it states that to update an
item
in a dataset, all I have to do is do
DataSet.Tables[0].Rows[0].ItemArray[1] = "String". When I attempt to
do
this it does not work.
Any help would be appreciated.