[dba-VB] closing your connections

Francisco Tapia fhtapia at gmail.com
Wed Jun 8 10:47:35 CDT 2011

so I have a vb.net app (visual studio 2008) and I am making some sproc calls
like so:

 conn = New SqlConnection(My.MySettings.Default.dbConn)
            cmd = New SqlCommand("dbo.stp_PCO", conn)
            cmd.CommandType = CommandType.StoredProcedure
            da.SelectCommand = cmd

I've also tried closing my connections after usage by using the following
closing statments

dtClockTable = nothing
cmd = nothing
da = nothing
conn = nothing

but when I check my sql server I still see sleeping entires in the activity
monitor suggesting that a connection is still active.  How do I sever the
connection completely?  I know a connection is alive and well because I
noticed that if I completely close the application the connection goes from
sleeping to gone.  I want my connections to close once the data has been
retrieved to allow the server to reuse that memory if needed.

in vb 6 it used to be so simple with just ado :(

your help is of course appreciated!


More information about the dba-VB mailing list