Connections That Microsoft Jet Cannot Close

There are two reasons that Microsoft Jet refuses a request to close a connection even when the idle time has expired. The first is pending query results, as discussed earlier in this chapter. If your application hasn’t finished retrieving the results of a query against a remote data source, Microsoft Jet will be unable to close the connection until the active statement on the connection has completed. To learn how to complete a statement, see “Completing Active Statements” earlier in this chapter.

The second reason that Microsoft Jet might refuse to close a connection is that the connection has a pending transaction. Your application must commit or roll back the transaction before Microsoft Jet can release the connection. Because the decision to commit or roll back is usually based on logic in your application, you must ensure that all branches in your decision tree result in one of these conclusions. If the application does not determine the outcome of the transaction, Microsoft Jet will automatically roll back the transaction when you close the Workspace object that initiated the transaction.