Hi,
I have an application, which opens many connection and after completing work
never closes connection. This is becoming a problem on sql server side.

I am thinking to write a tool which will close all the sleeping connection
at one run.

Is this possible ?. how will I get a info about connection from sql server?


Kishor

Re: Connection Pooling by Shawn

Shawn
Tue Jul 18 02:38:17 CDT 2006

Hello kishor,

The real trick is to get rid of th code that never closes the connection.
I know you're hoping to fix it with something less than that, but I doubt
your problems will disappear unless you fix it right.


Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com

> Hi,
> I have an application, which opens many connection and after
> completing work
> never closes connection. This is becoming a problem on sql server
> side.
> I am thinking to write a tool which will close all the sleeping
> connection at one run.
>
> Is this possible ?. how will I get a info about connection from sql
> server?
>
> Kishor
>



Re: Connection Pooling by Mary

Mary
Mon Jul 24 11:22:20 CDT 2006

To add to what Shawn said, you can more easily clean up connections by
wrapping them in using blocks. These are supported for both C# and VB
in 2.0. At the end of the using block, the connection is automatically
closed/disposed and returned to the pool so that it can be reused.

Using connection As New SqlConnection(connectionString)
connection.Open()
' Do work here.
End Using

using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
// Do work here.
}

--Mary

On Tue, 18 Jul 2006 00:11:01 -0700, kishor
<kishor@discussions.microsoft.com> wrote:

>Hi,
>I have an application, which opens many connection and after completing work
>never closes connection. This is becoming a problem on sql server side.
>
>I am thinking to write a tool which will close all the sleeping connection
>at one run.
>
>Is this possible ?. how will I get a info about connection from sql server?
>
>
>Kishor