|
Posted by Erland Sommarskog on 05/26/07 09:16
Shane (shane@weasel.is-a-geek.net) writes:
>> I am trying to write an application for a MSSQL database, using SQL
>> Express, and Visual Studio (Express edition)
>>
>> I tried to connect to an existing database (named testing) but to no
>> avail. Visual Studio claims the database does not exist.
>
> Sorry about that, a simple search turned it up. New problem however,
> when I go to connect to it I get the following error.
>
> Unable to open the physical file "C:\Program Files\Micrososft SQL
> Server\MSSQL.1\MSSQL\Data\testing.mdf", Operating System error 32: "32(The
> process cannot be access the file because it is being used by another
> process.)".
> An attempt to attach an auto-named database for file C:\Program
> Files\Micrososft SQL Server\MSSQL.1\MSSQL\Data\testing.mdf failed. A
> database with the same name exists, or specified file cannot be opened, or
> it is located on UNC share.
The error message indicates that the file is already open, presumably
by an SQL Server instance.
One possibility is that you have installed several instances of SQL Server
on your machine, not only an Express instance, and this database actually
belongs to some other instance.
But it could also be that you have created this database previously
from Mgmt Studio Express or similar and your Express instance is running.
But SQL Express has this feature User Instance, which does not exist in
any other SQL Server edition. A user instance is cloned off from the main
Express instance. It could be that Visual Studio starts up a user
instance, and then you cannot attach the database to the user instance,
if it's already attached to the main instance.
You may be better off asking a in newsgroup devoted to Visual Studio,
since this depends on what Visual Studio is doing behind the covers.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|