Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Memory Leak When You Use Now Function in SQL with Jet 4.0 Provider or Driver


View products that this article applies to.

This article was previously published under Q293876

↑ Back to the top


Symptoms

If an application connects to a database using the Microsoft Access ODBC Driver or the Microsoft OLE DB Provider for Jet version 4.0, and if the application uses the Now function of the Visual Basic for Applications in the WHERE clause of a SQL query, a memory leak occurs. If you use the function repeatedly, eventually enough memory leaks so that the application fails (crashes).

↑ Back to the top


Resolution

Install the latest Microsoft Jet 4.0 service pack. For additional information about how to install the latest Jet service pack, click the following article number to view the article in the Microsoft Knowledge Base:
239114� How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Create a new Visual Basic Standard EXE project. Form1 is created by default.
  2. Set a reference to Microsoft ActiveX Data Objects (ADO).
  3. Place a timer control on Form1, and set its Interval property to a value such as 1000.
  4. Paste the following code:
    Dim m_connADO As ADODB.Connection
    
    Private Sub Form_Load()
        Set m_connADO = New ADODB.Connection
        m_connADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                       "Data Source=C:\Program Files\Microsoft Visual Studio\Vb98\nwind.mdb;"
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        Timer1.Enabled = False
        m_connADO.Close
        Set m_connADO = Nothing
    End Sub
    
    Private Sub Timer1_Timer()
        Dim rsTemp As ADODB.Recordset
        Dim strQry As String
        Debug.Print "Timer event: " & Now
        strQry = "SELECT * FROM Orders WHERE OrderDate <= Now()"
        Set rsTemp = m_connADO.Execute(strQry)
        rsTemp.Close
        Set rsTemp = Nothing
    End Sub
    					
  5. Run the project, and use the Performance Monitor tool or Task Manager to monitor the memory usage.

↑ Back to the top


References

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
239114� How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine

↑ Back to the top


Keywords: kbbug, kbdatabase, kbfix, kbgraphxlinkcritical, kbjet, kbmdacnosweep, KB293876

↑ Back to the top

Article Info
Article ID : 293876
Revision : 5
Created on : 1/6/2004
Published on : 1/6/2004
Exists online : False
Views : 462