I am trying to compact an Access Database but it is failing because a connection to 开发者_StackOverflow中文版the database is still open. How can I drop all connections to the database programmatically?
Short answer you cant, long answer you can!
There is no built in way of doing this like on a SQL server however with a bit of preplanning you can set things up to kick users out of a database. See this article on some methods you can use
http://www.rogersaccesslibrary.com/download3.asp?SampleName=LogUsersOff.mdb
The access program may be open or the process is still running. Check out these two links on how to kill processes.
http://www.codeproject.com/KB/cs/cskillapp.aspx
http://www.csharpcorner.com/UploadFile/scottlysle/ProcessKillCSharp04302008060422AM/ProcessKillCSharp.aspx
精彩评论