开发者

"File in Use" error from vb.net

When I try to connect to a database that was previously opening with 开发者_如何学JAVAa SQL connection I get a "File in Use" error. Process Explorer tells me that sqlservr is still holding the file. Any ideas on how to get sql to release the file from within the vb.net 2010 code?


After you closed the connection you must call

SqlConnection.ClearPool 

or

SqlConnection.ClearAllPools

in order to release the files from the SqlServer.


Which file is this? Is it a file that's normally internally managed by the SQL server? If so, then you'll probably have to ask the SQL server to shut itself down before you can open the file.

You may also want to consider your reasons for wanting to access such a file. If it's for backup purposes, you are almost always better off using the services of your database to perform backups, instead of trying to do it yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜