Error : SqlTransaction has completed; it is no longer usable

  • Hi

    I get below error when the application tries deleting some data from sql server.

    What can cause it and how to fix it?

    Error:

    This SqlTransaction has completed; it is no longer usable.

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

    at System.Data.SqlClient.SqlTransaction.Rollback()

    at GETOtis.DatabaseWrapper.SqlHelper.RollbackTransaction()

    at GETOtis.BusinessObject.clsDeleteBuilding_Rule.DeleteBuilding(clsDeleteBuilding_Data objRequest)

    at GETOtis.UI.SR_TreeView.DeleteBuilding()

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

  • I am assuming you are getting this error from a .NET application. It looks like, based on the error, your application has a logic error so that it is trying to Rollback the transaction AFTER it has committed it. It's like the application has something like this pseudocode:

    If Not Error Then

    Commit Transaction

    End If

    RollBack Transaction

    When you should have:

    If Not Error Then

    Commit Transaction

    Else

    RollBack Transaction

    End If

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply