DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: General Transaction Question (Commit)

  1. #1
    Join Date
    Jul 2004
    Posts
    366

    Question General Transaction Question (Commit)

    Good Morning All,

    I have a process that updates roughly 4 tables at one time. I'm using a transaction. My question is this:

    1. Do you have to code for whether or not each query was successful or does the transaction do that for you?

    2. Should you only set the Rollback in the event of an error or should you track if each update was made and if not then rollback?

    Example:

    dim intA as integer = Update1()
    dim intB as integer = Update2()

    if intA = 1 and intB = 1 then

    Transaction.Commit

    else

    Transaction.RollBack

    end if

    OR

    try

    dim intA as integer = Update1()
    dim intB as integer = Update2()

    transaction.commit

    catch ex as exception

    transaction.rollback

    end try


    Thanks in advance all!

    jb

  2. #2
    Join Date
    Feb 2006
    Posts
    133
    Hi,

    to start you do a begintransaction

    do this
    do that


    if everything runs fine(no errors and update succesful) you do a commit.
    If you catch an error during the proces you do a rollback, I also check if the update returns ok. Sometimes you don't get an error and there wasn't an update.

    Hope this helps.
    Benjamin

Similar Threads

  1. Replies: 0
    Last Post: 04-03-2009, 03:13 AM
  2. A General Question
    By neo22 in forum Java
    Replies: 2
    Last Post: 03-28-2006, 04:23 PM
  3. Display one record at a time!
    By ASP learner in forum ASP.NET
    Replies: 5
    Last Post: 10-08-2002, 07:17 PM
  4. Replies: 0
    Last Post: 07-12-2001, 08:26 PM
  5. VB,STORED PROC, COM, DTC QUESTION?
    By melvin ng in forum VB Classic
    Replies: 1
    Last Post: 11-10-2000, 04:46 AM

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