Wednesday, December 30, 2009 2:36 AMHi, all
when I connect to sql server using connection.Open(), I got following exception:
TransactionAbortedExceptionThe transaction has aborted.
TransactionPromotionExceptionFailure while attempting to promote transaction.
SqlExceptionThe PROMOTE TRANSACTION request failed because there is no local transaction active.
at System.Transactions.TransactionStateAborted.CheckForFinishedTransaction(InternalTransaction tx)
at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)
at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte whereabouts)
at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte whereAbouts)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction)
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
I have never heared about sql transaction cookie before, any one have ideas on this? Thank you in advance!
- Moved by Arnie RowlandMVP Monday, January 11, 2010 5:52 AM Better Forum (From:Transact-SQL)
Wednesday, December 30, 2009 3:18 AMThanks, Any idea how to resolve this issue?
Wednesday, December 30, 2009 3:43 AM
it is .net web application, this code work fine in the past. this exception happened since yesterday, I guess some transaction not be released.
public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter commandParameters)
if (connectionString == null || connectionString.Length == 0) throw new ArgumentNullException("connectionString");
// Create & open a SqlConnection, and dispose of it after we are done
using (SqlConnection connection = new SqlConnection(connectionString))
connection.Open(); // exception happened here
// Call the overload that takes a connection in place of the connection string
return ExecuteNonQuery(connection, commandType, commandText, commandParameters);
Wednesday, December 30, 2009 6:21 AMyes, I have try to re-start IIS but still have such issue, I think SQL Server must cached something.
Wednesday, December 30, 2009 9:41 AMyes, I have try to re-start the sql, still do not work. Thank you all the same for your kindly help!
Wednesday, December 30, 2009 5:02 PMSorry, no other ideas. Perhaps this question may be asked in the Database Engine forum.
Premature optimization is the root of all evil in programming. (c) by Donald Knuth
Naomi Nosonovsky, Sr. Programmer-Analyst
Wednesday, December 30, 2009 10:16 PMThis is really a .NET question, not a SQL Server question. You would get a better answer from the .NET forums.
Monday, January 11, 2010 5:25 AMit should be an code issue of incorrect using transaction in TransactionScope. it works after removed the TransactionScope statement.
- Edited by Jason Van Eaton - MSFTMicrosoft Employee, Moderator Monday, January 11, 2010 2:35 PM He provided a more complete answer in a different thread - copied it here.
- Marked As Answer by Jason Van Eaton - MSFTMicrosoft Employee, Moderator Monday, January 11, 2010 2:35 PM
Monday, January 11, 2010 6:10 AMThis post looks like a duplicate to this thread.
"You cannot do a kindness too soon because you never know how soon it will be too late." -Ralph Waldo Emerson