Results 1 to 2 of 2

Thread: DB connect causing memory leak

  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

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Uhh... this is the games and graphics forum...
    Harry.

    "From one thing, know ten thousand things."

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