Monday, March 19, 2012

connection leak

Hi, in my web application i had a connection leak now that i solve this problem, i want to check if all connections are really closed.

I make a connection to an sql database.

I try on the database the sp_who procedue but i think, this is not that i can see if i colse all, connections

is there a other way to check or see if all connections are closed.

Enclosing the connection objects inside the "Using" block will make sure that the connection object is disposed off properly preventing any connection leaks. For e.g:

using(SqlConnection cn = new SqlConnection())

{

//DAL code

}


Check this out for details:

codebetter.com/blogs/john.papa/archive/2005/04/01/60984.aspx

Hope this helps,

Vivek

No comments:

Post a Comment