I am connection to an Access Database using a OleDatabase Connection. The problem is that I need to programmatically run the compact and repair operation on the database, however I can not do this while there are still open connections to the database. The connections that exist are of course the connections from the connection pool from my program, however I can not seem to figure out how to clear the pool so that I can 开发者_如何学运维run the compact and repair.
I do have a using statement on all connections that get opened to the database so the problem is not that I am not disposing of the connections properly, the problem is the connection pool.
Call the static method ReleaseObjectPool
on the the OleDbConnection
- see http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.releaseobjectpool.aspx
精彩评论