-
I've noticed that in the SQL Server performance monitor, when my application starts, as I open up forms that establish connections the performance monitor shows that the number of connections is increasing. When I close the forms it doesn't look like the number of connections goes down. The connections don't go down until the program is closed.
Is there something I need to put in my code to close those connections? What ramifications are there to the connections not being closed down?
-
in what scope do you have your connection object? (global/module/procedure)
Does your application reside within IIS or MTS?
-
The application isn't using IIS or MTS.
I've tried the connection object as a local variable in the form load event and as a global variable. It seems to work the same way in both events.
-
I don't know, this code works fine for me. I have verified it using the performance monitor
Code:
Private Sub Form_Load()
Dim cn As Connection
Set cn = New Connection
cn.Open "Provider=SQLOLEDB;Data Source=W2kSRV;Integrated Security=SSPI;"
End Sub
I didn't explicitly close or release the connection object to see if this was the problem, but the implicit object destruction worked fine....
Note that I am using ADO 2.5, the native OLEDB provider for SQL server (not ODBC), and SQL Server 7 SP2