J
Jay
I'm currently debugging an application. Unfortunately, it is one of those
problems that happens sporadically, and I haven't found a reliable way to
reproduce it.
The basic structure of my code is:
try
{
// execute some update stored procedures
sqlTransaction.Commit();
}
catch
{
sqlTransaction.Rollback();
// throw exception to indicate to higher level code that an error
occurred.
}
When the problem occurs, the symptom I see is that my data is saved, but a
rollback is attempted anyway, and an InvalidOperationException (this
SQLTransaction has completed; it is no longer usable) is thrown. So, I'm
trying to understand how my Commit could execute (the last line of my try
block), yet my catch block get executed.
Is it possible for the database to commit a transaction successfully, but an
exception still be thrown by the SQLTransaction Commit method?
The error seems to occur when the database has a heavy load. For example,
could the commit method timeout (the database executes the commit, but word
doesn't get back to ADO.NET before the timeout expires)?
problems that happens sporadically, and I haven't found a reliable way to
reproduce it.
The basic structure of my code is:
try
{
// execute some update stored procedures
sqlTransaction.Commit();
}
catch
{
sqlTransaction.Rollback();
// throw exception to indicate to higher level code that an error
occurred.
}
When the problem occurs, the symptom I see is that my data is saved, but a
rollback is attempted anyway, and an InvalidOperationException (this
SQLTransaction has completed; it is no longer usable) is thrown. So, I'm
trying to understand how my Commit could execute (the last line of my try
block), yet my catch block get executed.
Is it possible for the database to commit a transaction successfully, but an
exception still be thrown by the SQLTransaction Commit method?
The error seems to occur when the database has a heavy load. For example,
could the commit method timeout (the database executes the commit, but word
doesn't get back to ADO.NET before the timeout expires)?