Closing a connection
Posted on 2004-10-27
I got two parts to my problem:
1. When I open a connection to sql2000 db, query analyzer shows two connections from my machine (using sp_who). Any ideas why? Here is the code (very basic):
Public Class Class1
Public Sub opencon()
Dim conConnection As New System.Data.SqlClient.SqlConnection
conConnection.ConnectionString = "(con string here)"
conConnection = Nothing
On a form:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As New Class1
x = Nothing
2. Even tho dispose is called for both the conn and class, the connection is still alive and well in query analyzer. Should it not be destroyed by the dispose?