Database Connection

  • Thread starter Thread starter GK
  • Start date Start date
G

GK

Hi,
When I run the following:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strConnection As String = "data source=csql;initial
catalog=dbname;persist security info=False;user id=user;pwd=pwd;workstation
id=;packet size=4096"
Dim cn As New SqlClient.SqlConnection(strConnection)
cn.Open()

cn.Close()
cn.Dispose()
cn = Nothing
End Sub

When I execute SP_WHO in query analyzer , it always show this user. What do
I have to do to distroy this connection when it is out of scope.
Thanks,
GK
 
You are using the connection pool.
When you close a connection you don't really break the connection and when
you open a new connection, it will use the old connection.

I hope I have been clear.
Excuse for my bad english.
 
your english is just fine.

You are using the connection pool.
When you close a connection you don't really break the connection and when
you open a new connection, it will use the old connection.

I hope I have been clear.
Excuse for my bad english.
 
Back
Top