Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Threading issue with Com??

Status
Not open for further replies.

hwkranger

MIS
Nov 6, 2002
717
US
I have the error:

destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations

This is the line that creates it:

Code:
jro.CompactDatabase(strSource, strDest)

in the context of:

Code:
    Public Sub CompactFile(ByVal DBFileName As String)
        Dim jro As JRO.JetEngine
        jro = New JRO.JetEngine

        Dim tempDBFileName As String
        tempDBFileName = "c:\temp\cmp.mdb"

        If System.IO.File.Exists(tempDBFileName) = True Then Kill(tempDBFileName)

        Dim strSource As String
        Dim strDest As String
        strSource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBFileName
        strDest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & tempDBFileName & ";Jet OLEDB:Engine Type=5"

        jro.CompactDatabase(strSource, strDest)
        Kill(DBFileName)
        System.IO.File.Move(tempDBFileName, DBFileName)

    End Sub


This is from a com reference (I know unmanaged code, but I don't know how to do this in .net)

Could someone please help me? I'm not sure how to fix this...


Randall Vollen
Merrill Lynch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top