In C #, you usually close connections immediately after using them, for example:
using(SqlConnection connection = ...) { ... do something ... }
Typically, you will use a connection pool, and all this returns a connection to the pool. That way, your process will still have active connections to the database server.
If you shut down cleanly, the connection pool will undoubtedly be cleared and the actual database connections will be closed (you can check this by looking at the open connections on the database server).
But there are situations (for example, calling the .FailFast environment) where the application may crash without closing the connection - in this case, they will eventually time out and be closed by the database server.
Joe
source share