Re: Update and Inserting Dataset

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Carlos Hernandez (carlos_at_integrasofthn.com)
Date: 09/02/04


Date: Thu, 2 Sep 2004 08:33:18 -0600

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.
"Val Mazur" <group51a@hotmail.com> wrote in message
news:uhdtOMJkEHA.3392@TK2MSFTNGP15.phx.gbl...
> Hi Carlos,
>
> What about updating in a transaction? In this case if something failed,
> then you could rollback all the changes in a database
>
> --
> Val Mazur
> Microsoft MVP
>
>
> "Carlos Hernandez" <carlos@integrasofthn.com> wrote in message
> news:uH5lz8DkEHA.2140@TK2MSFTNGP15.phx.gbl...
>>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.
>>
>
>



Relevant Pages

  • Re: Classic Nest SP with Transaction Question
    ... enclosing transaction or should begin and commit/rollback its own ... > I echo Ron's points and also have been using an approach very similar to> Tom's method of using a SAVE PT instead of starting a new TRANSACTION if the> ChildSP is called from the ParentSP. ... > The ParentSp now has to ROLLBACK everything up to that point. ... As Ron> mentioned, the ParentSP may have called many child SPs, and performed many> updates up to this point, and all of these need to be rolled back. ...
    (microsoft.public.sqlserver.programming)
  • Re: Scope of transaction processing wrapper
    ... Just pass the Database variable, and it will all rollback. ... This article illustrates transactions: ... My question is on the scope of what transaction ...
    (comp.databases.ms-access)
  • Re: Classic Nest SP with Transaction Question
    ... PMFJI, but if your child proc is using an explicit tran, then it can be coded as follows: create proc dbo.ChildProc as set nocount on declare @trancount int set @trancount = @@TRANCOUNT if @trancount> 0 begin tran ChildProcTran else save tran ChildProcTran /* ... Do some stuff */ if @@ERROR> 0 begin raiserror rollback ChildProcTran return end ... commit tran go ... I believe I'm having the same issue as Chad with nested stored procedures inside a transaction. ...
    (microsoft.public.sqlserver.programming)
  • Re: global synchronization point
    ... I'm not thinking of the transaction begin/commit/rollback cycle, ... and rollbacks, and then do a global rollback to a given point of time. ... If you perform database+transaction log dumps for your database ... For ASE servers, @@verion is a server-wide, global variable that ...
    (comp.databases.sybase)
  • Re: Classic Nest SP with Transaction Question
    ... This will take care of what is done in the child, but what I want to do is ... rollback the entire outer transaction - the one initiated in the outer SP. ...
    (microsoft.public.sqlserver.programming)