开发者

How to clear the connection pool for an OleDbConnection

开发者 https://www.devze.com 2023-03-24 02:59 出处:网络
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 whi

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

0

精彩评论

暂无评论...
验证码 换一张
取 消