Take full advantage of connection pooling. To get the most out of connection pooling in ADO.NET, keep the following in mind when developing your ASP.NET applications:
Be sure than your connections use the same connection string each time. Connection pooling only works if the connection string is the same. If the connection string is different, then a new connection will be opened, and connection pooling won't be used.
[g]Only open a connection when you need it, not before.[/g]
Close your connection as soon as you are done using it.
Don't leave a connection open if it is not being used.
Be sure to drop any temporary objects before closing a connection.
Be sure to close any user-defined transactions before closing a connection.
Don't use application roles if you want to take advantage of connection pooling. [7.0, 2000] Updated 1-2-2004 |