Does SqlConnection.Dispose() perform a rollback on all pending transactions?

.net, ado.net, sql-server

Solution

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.

Problem

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?

Original source

Related problems