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?
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?

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?
i am using sql server 2005 express.

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.
I have enabled TCP/IP but now I get a different error.

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.
I have now created it via Visual C# Express and it works fine![]()
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!
There are currently 1 users browsing this thread. (0 members and 1 guests)