Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    Uppsala, Sweden
    Posts
    4

    Unanswered: BeginTrans or Execute "begin transaction"?

    Not sure if this is really a programming question or if it should be a sql server question, but I'll try it here

    Working on optimizing some code in a program that have been causing some problems.
    The major problems I've already solved, but I got curious if changing from implicit to explicit transactions would be a positive or negative effect?
    Haven't really found any information in what situations it would be better to use one of them when it comes to safety, performance and so on.

    Code today...
    cnn.BeginTrans ( = set implicit_transactions on in sql server)
    ...a bunch of insert/update/delete and potentional rollbacks
    cnn.CommitTrans

    Possible change...
    cnn.Execute "BEGIN TRANSACTION"
    ...a bunch of insert/update/delete and potentional rollbacks
    cnn.Execute "COMMIT TRANSACTION"

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Quote Originally Posted by kryptonit View Post
    Not sure if this is really a programming question or if it should be a sql server question, but I'll try it here

    Working on optimizing some code in a program that have been causing some problems.
    The major problems I've already solved, but I got curious if changing from implicit to explicit transactions would be a positive or negative effect?
    Haven't really found any information in what situations it would be better to use one of them when it comes to safety, performance and so on.

    Code today...
    cnn.BeginTrans ( = set implicit_transactions on in sql server)
    ...a bunch of insert/update/delete and potentional rollbacks
    cnn.CommitTrans

    Possible change...
    cnn.Execute "BEGIN TRANSACTION"
    ...a bunch of insert/update/delete and potentional rollbacks
    cnn.Execute "COMMIT TRANSACTION"
    I personally prefer the second approach. IMO, it's cleaner, as it's more explicit; it doesn't depend upon ADO to translate the BeginTrans method to the SQL Begin Transaction statement behind the scenes.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •