rowstate question

  • Thread starter Thread starter Tina
  • Start date Start date
T

Tina

I'm manipulating a dataset in code by deleting and adding records. When I'm
done, the user has an opportunity to save or cancel the whole thing. If he
says Save, I delete everything in the database and now want to write this
dataset to the database.

In some cases some or all of the rows rowstate is unchanged so when I do a
da.update(ds) no update takes place. I want to change the rowstate to added
but it's readonly.

How can I get the database updated regardless of the value of rowstate?
thanks,
G
 
tina,

i don't think deleting all your data is a good
idea at all (very risky actually). the Update method of
SqlDataAdapter is smart enough to determine which records
needs an update in the database.

HTH,
 
we have to fool the dataadaper because we are resequencing one of the key
fields. We have to (1) delete everything (2) replace eveything.
 
Hi Tina,

Tina said:
I'm manipulating a dataset in code by deleting and adding records. When I'm
done, the user has an opportunity to save or cancel the whole thing. If he
says Save, I delete everything in the database and now want to write this
dataset to the database.

I won't even question you about this practice :-)
In some cases some or all of the rows rowstate is unchanged so when I do a
da.update(ds) no update takes place. I want to change the rowstate to added
but it's readonly.

How can I get the database updated regardless of the value of rowstate?
thanks,

You might create a copy of dataset's structure and then copy rows into it
(perhaps using LoadDataRow method).
The rows will have RowState.Added.
 
Back
Top