Update and Inserting Dataset

  • Thread starter Thread starter Carlos Hernandez
  • Start date Start date
C

Carlos Hernandez

I am using datasets and the command builder to update my database. It works
fine, but if there is an exception of any kind after and update of one of my
datasets, then the dataset state is leaved in unchanged, and the next time I
save I get an DBConcurrencyValidationException. What I do in the insert
method of my class, is to detach this row, and attched it again. But in the
update method what can I do?, If I remove and add the row, the stated will
be added, and this will try to insert the data instead of updating..


Thanks in advance for your help.
 
Hi Carlos,

What about updating in a transaction? In this case if something failed, then
you could rollback all the changes in a database
 
The transaction is not a problema, all this process occurs within a
transaction. My process does a rollback if anything goes wrong, the problem
is not this, the problem is that the datasets thinks he made the changes,
and the state is unchanged, not added. So when I try again to save the data,
I get a concurrency violation because my datasets returns 0 records updates.

Thanks.
 
Back
Top