Results 1 to 4 of 4

Thread: ADO/SQL Server connection releasing

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    51

    Question

    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?

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    in what scope do you have your connection object? (global/module/procedure)

    Does your application reside within IIS or MTS?

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    51
    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.

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width