Transaction not connected, or was disconnected error

I am getting

“Transaction not connected, or was disconnected error”

  • get ssis package output from SP
  • How use inserted\deleted table in stored procedure?
  • Rolling back and update command in Sql Server 2000
  • How to convert SQL table into a customised gridview
  • SQL Server CLR Threading
  • SQL Table Size And Query Performance
  • error when the transaction is either committed/rolled back after doing a bulk insert (along with some other operations).

    using(var tran = Session.Session().BeginTransaction(IsolationLevel.Serializable))
           // do something
           fullSession.Session().CreateSQLQuery(query).ExecuteUpdate();// this query bulk insert in a temp db
           // do something else
           tran.Commit()/ tran.RollBack();// if transaction is active and not already rolled back/committed

    If the query to bulk insert from a file into a temp database fails, I get this error on tran.Commit/rollback.

    3 Solutions collect form web for “Transaction not connected, or was disconnected error”

    Bulk Insert is a combination of Insert statements so if it fails it doesn’t roll back the transaction so if you really want to catch the error try using Try and catch block inside BEGIN and END transaction

    I was getting this exact same error using NHybernate while persisting an entity that had a property of type System.Data.SqlTypes.SqlDateTime? (Nullable).

    Changing the property to a regular System.DateTime? fixed the problem.

    I had some problem, but it gone after I close connection in MS SQL Managment studio.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.