MS SQL Server and BEGIN TRANSACTION

  1. 4 years ago

    Bob K

    5 Sep 2015 Pre-Release Testers, Xojo Pro Kansas City

    Having a weird issue with MS SQL Server. I'm trying to create a transaction and I've verified that I've started the transaction with

    db.SQLExecute( "BEGIN TRANSACTION" )

    but then when I got to commit I get the following error: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.

    I've verified that I'm not calling BEGIN TRANSACTION more than once but it *is* getting called with no errors.

    Anyone have suggestions on things to look at?

  2. Norman P

    5 Sep 2015 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    almost sounds like its already been committed so you end up having a commit with the begin

    but I'm sure you've looked into that already

  3. Bob K

    5 Sep 2015 Pre-Release Testers, Xojo Pro Kansas City

    Yeah. This is in ActiveRecord and not having any issues with any of the other databases - just MS SQL Server.

  4. Norman P

    5 Sep 2015 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    Begin Transaction didn't happen to fail did it ?
    Its been a few years but I can't imagine what else unless you've nested them or used something like begin transaction with a named transaction the commit without closing a named one
    There's only a handful of reasons this should occur

  5. José M

    5 Sep 2015 Pre-Release Testers, Xojo Pro Spain

    Never used MS SQL Server, but may be some kind of autocommit?.

  6. Norman P

    5 Sep 2015 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...
    Edited 4 years ago

    Unlikely if you have explicitly started one
    Oh but there is one option.... are you using ODBC ?
    You'll love this one if you are ....
    see
    https://technet.microsoft.com/en-us/library/ms175127(v=sql.105).aspx
    where it says
    The ODBC API does not support explicit transactions, only autocommit and implicit transactions.

  7. Bob K

    5 Sep 2015 Pre-Release Testers, Xojo Pro Kansas City

    No, definitely not ODBC. This is native SQL Server.

  8. Norman P

    5 Sep 2015 Xojo Inc, Pre-Release Testers, Xojo Pro Seeking work. npalardy@great-w...

    OK that rules that out

    Hmmm ... begin isn't failing somehow ?
    I'm out of ideas as to why it might give you that on a commit

  9. Bob K

    5 Sep 2015 Pre-Release Testers, Xojo Pro Kansas City

    I will end up breaking it down into something uber simple first. If I can replicate it that way then it's simple enough to send in for the engineers to look at. Otherwise it will prove that's it's something with ActiveRecord and the real fun begins.

  10. Russ L

    6 Sep 2015 Pre-Release Testers, Xojo Pro

    You can use

    Exec sp_who2

    See if you can find the begin transaction and then see if the other statements are on the same spid

  11. 3 months ago

    Jürg O

    May 23 Pre-Release Testers, Xojo Pro

    This has come up again in this Forum Thread (which I think has an answer and a workaround).

or Sign Up to reply!