Close
Connection.Close();
Closes the connection. This method also rolls back any pending transactions, if necessary, and ends by releasing the connection to the connection pool (assuming connection pooling is enabled). No exception is thrown if the connection is already closed.
The Close( )
method is preferred over the
Dispose( )
method because the Dispose( )
method destroys the connection and
doesn’t return it to the connection pool. To ensure
that connections are closed properly, even in the case of an
unhandled error, you should close them in the
finally
block of an exception handler.