5

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?

Community
  • 1
  • 1
Juan C.
  • 51
  • 1
  • 5

1 Answers1

4

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.

Davide Icardi
  • 11,919
  • 8
  • 56
  • 77