Results 1 to 2 of 2

Thread: DB connect causing memory leak

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    SA
    Posts
    13

    Post

    Can anyone please tell me what I am doing wrong. This increases the memory by 9000k and it is not released when I do the terminate.

    <code>
    Private adoConnection As ADODB.Connection
    Private Sub Class_Terminate()
    On Error Resume Next

    ' Remove the Connection Object
    Set adoConnection = Nothing

    End Sub
    Public Sub ConnectToDB(ByRef strDSN As String, ByRef strUID As String, ByRef strPWD As String)

    On Error GoTo ConnectToDBErr

    Dim strConnectString As String

    Set adoConnection = New ADODB.Connection

    strConnectString = "uid=" & strUID & ";pwd=" & strPWD & ";dsn=" & strDSN
    ' strConnectString = "User ID=" & strUID & ";Password=" & strPWD & ";Data Source=10.149.2.24;DSN=OracleIVRDSN"
    ' adoConnection.Provider = "MSDAORA"

    ' Establish a connection to the database
    adoConnection.ConnectionString = strConnectString

    adoConnection.Open

    ' The Database connection was opened successfully
    IsOpen = True

    ConnectToDBExit:
    Exit Sub

    ConnectToDBErr:
    On Error Resume Next
    ' Remove the Connection Object
    Set adoConnection = Nothing

    ' The Database connection was not opened
    IsOpen = False

    ' Err.Raise 1008, "clsDatabaseAccess", "Could not connect to the database. No files will be processed."
    addLogEntry (Err.Number + " - " + Err.Description)

    Err.Raise Err.Number, Err.Source, Err.Description
    Resume ConnectToDBExit

    End Sub
    <\Code>

    Thanking you in advance!!!!
    Attached Files Attached Files

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