I have an application which potentially does thousands of inserts to a SQL Server 2005 database. If an insert fails for any reason (foreign key constraint, field length, etc
According to this post: http://blogs.msdn.com/b/dataaccesstechnologies/archive/2010/08/24/zombie-check-on-transaction-error-this-sqltransaction-has-completed-it-is-no-longer-usable.aspx
A temporary solution could be to try catching the rollback or commit operation. So this code will be enough for stopping the bug to be throwing:
public static void TryRollback(this System.Data.IDbTransaction t)
{
try
{
t.Rollback();
}
catch (Exception ex)
{
// log error in my case
}
}
public static void TryCommit(this System.Data.IDbTransaction t)
{
try
{
t.Commit();
}
catch (Exception ex)
{
// log error in my case
}
}
Check this example from msdn website: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx