Possible Duplicate:
What happens to an uncommitted transaction when the connection is closed?
I know a SqlTransaction
will rollback itself on Dispose()
(see Will a using statement rollback a database transaction if an error occurs?), but will it be rolled back when its parent SqlConnection
is disposed?
Yes, but I don't think it is handled by SqlConnection class.
I think it's SQL Server that when the connection is closed automatically roll back all not committed transactions.
Also consider that SqlConnection has a connection pool by default. So it is possible that when you close/dispose a SqlConnection the "real" db connection is still active.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With