Transaction commit


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Transaction commit

  1. #1
    Prakash Dharan Guest

    Transaction commit

    Hi,

    In our application for a particular we have to update two databases and a
    set of tables in each database.

    But the consitency should be maintained, that the whole transaction should
    be saved only if all the inserts and updates in both the databases succeed.
    Without going for MTS or COM+ what is the alternative way to do that?

    Any suggestion or idea will be greatly appreciated.

    Regards
    Dharan



  2. #2
    Richard Lloyd Guest

    Re: Transaction commit


    Hey Dharan,

    You can use transactions on the ADODB.Connection object.

    To start a transaction there is a method called '.BeginTrans'.
    To commit the transaction call '.CommitTrans' and if there is an error or
    you want to cancel all the updates call '.RollbackTrans'

    For example...

    -----------------------------

    Dim objCon As ADODB.Connection
    Set objCon = New ADODB.Connection

    ' Begin Transaction
    objCon.BeginTrans

    ' Commit updates
    objCon.CommitTrans

    ' Don't Commit any updates
    objCon.RollbackTrans

    -----------------------------


    Hope this helps!

    Rich


    "Prakash Dharan" <dharan@facilityoffice.com> wrote:
    >Hi,
    >
    >In our application for a particular we have to update two databases and

    a
    >set of tables in each database.
    >
    >But the consitency should be maintained, that the whole transaction should
    >be saved only if all the inserts and updates in both the databases succeed.
    >Without going for MTS or COM+ what is the alternative way to do that?
    >
    >Any suggestion or idea will be greatly appreciated.
    >
    >Regards
    >Dharan
    >
    >



  3. #3
    Miha Markic Guest

    Re: Transaction commit

    Hi Prakash.

    You have to manually control it.
    Like:

    a.starttransaction
    b.starttransaction
    on error goto abort
    ....
    a.commit
    b.commit
    exit sub
    Abort:
    a.rollback
    b.rollback

    --
    Miha
    www.spin.si
    "Prakash Dharan" <dharan@facilityoffice.com> wrote in message
    news:3b32d80c@news.devx.com...
    > Hi,
    >
    > In our application for a particular we have to update two databases and a
    > set of tables in each database.
    >
    > But the consitency should be maintained, that the whole transaction should
    > be saved only if all the inserts and updates in both the databases

    succeed.
    > Without going for MTS or COM+ what is the alternative way to do that?
    >
    > Any suggestion or idea will be greatly appreciated.
    >
    > Regards
    > Dharan
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center