A
Angel Saenz-Badillos[MS]
The following information is not true for SqlClient:
It is very simple to write an application that disproves this so if you have
any questions you should try it yourself. Dispose only does two things,
first it deletes the connection string and then it calls Close. There is no
functional difference between Close and Dispose and you can call either or
both without a problem.
It is highly recommended that you call Close inside of a Finally block or
that you use the "using" construct when using SqlConnections to make sure
that the connections are properly closed and that you don't leak connections
in cases where execute throws an exception.
Hope this helps
</Warning>"The Dispose() method releases all resources associated to the connection
object (including removing it from the connection pool). Not a good practice
to call Dispose() unless you want connection to be removed from the
connection pool."
It is very simple to write an application that disproves this so if you have
any questions you should try it yourself. Dispose only does two things,
first it deletes the connection string and then it calls Close. There is no
functional difference between Close and Dispose and you can call either or
both without a problem.
It is highly recommended that you call Close inside of a Finally block or
that you use the "using" construct when using SqlConnections to make sure
that the connections are properly closed and that you don't leak connections
in cases where execute throws an exception.
Hope this helps