C
cjobes
Hi all,
I don't know how many hours I've spend on this but I don't want to give up
and there has to be a way of doing this. Here is what I'm trying to do:
I have a small Windows Forms app where I create a DataSet to hold temp info.
I do not need to display the data to the user but I need to manipulate the
data with code. There is just one table in the set with 8 columns. One of
the columns is configured as a PK. In the code I step through the rows and
test for conditions. Once I have found a row that meets the condition I need
to update one column of the row with new data.
The books (I have several that I bought out of desperation looking for
answers) say that if you have a unique key (PK is def. unique) and you use
the dt.rows.add with an existing value for the PK, it will replace data
rather than creating a new row. When I tried that an exception was thrown. I
then used the dt.BeginLoadData. That didn't work either. It still created a
new row and when I issued the dt.EndLoadData I got an exception that there
are 2 rows with the same value.
Can anybody tell me how I can change the value of one column through code
without binding den DataSet to a list or DataGrid? There has to be a way of
doing this.
Thanks
Claus
I don't know how many hours I've spend on this but I don't want to give up
and there has to be a way of doing this. Here is what I'm trying to do:
I have a small Windows Forms app where I create a DataSet to hold temp info.
I do not need to display the data to the user but I need to manipulate the
data with code. There is just one table in the set with 8 columns. One of
the columns is configured as a PK. In the code I step through the rows and
test for conditions. Once I have found a row that meets the condition I need
to update one column of the row with new data.
The books (I have several that I bought out of desperation looking for
answers) say that if you have a unique key (PK is def. unique) and you use
the dt.rows.add with an existing value for the PK, it will replace data
rather than creating a new row. When I tried that an exception was thrown. I
then used the dt.BeginLoadData. That didn't work either. It still created a
new row and when I issued the dt.EndLoadData I got an exception that there
are 2 rows with the same value.
Can anybody tell me how I can change the value of one column through code
without binding den DataSet to a list or DataGrid? There has to be a way of
doing this.
Thanks
Claus