Jump to content

When connecting to a database I get told the file is already in use


Recommended Posts

Posted

Hi,

 

In Visual c# express I am trying to connect to a database but I keep getting told that database is already in use when it isnt, how do I fix this?

Posted
Access databases have a locking file that is created when someone uses it. Sometime that gets left behind and needs deleting manually. Is this the sort of thing you need to be looking for perhaps?
Posted
Have you made sure that you can connect to the database initially by enabling TCP/IP in the SQL Server Configuration Manager. You could also try restarting the SQL server service for the instance that you are using.
Posted
Did you make the database manually of let Visual studio do it for you. I would suggest creating the DB in VS as it will handle all of the linking and file permissions. It looks like that database may be corrupted or have invalid file permissions that the SQL Services user account can't open.
  • Thanks 1
Posted

There can be a problem with the Visual Studio database explorer - when you use that to look at the tables etc it doesn't seem to co-operate nicely with your running code. Close the object browser (restart the SQL Server service if necessary) and things should work again.

 

I've seen this before and it's a real pain - it's documented somewhere in the MS KB but I don't think they see it as a bug!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...