I installed Visual C++ Express 2005 and MS SQL Server 2005 express. I was playing with the idea of creating a front end program and writing/reading to the MS SQL database. I created a new database using the SQL server management express and was looking to connect the database to my Visual C++ program. In the Visual C++ Express, I see there is a Database explorer in which I can connect to a database. I put in the correct .mdf filename, put when I press OK, I get the following message:
"Unable to open the physical file c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\test1.mdf
Operating system error 32 "32(The process cannot access the file because it is being used by another process.)"
An attempt to attach an auto-named database for file c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\test1.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on a UNC share"
Can someone help point me in the right direction with what I
Visual C++ Express to MS SQL Server Express question?
I am not a VC++ guy but it seems like you cannot access an existing databases in the manner you are trying to.
Try to detach you database from with SQL Server and then try it. It might work.
Read more carefully you VC++ documentation.
Ways of connecting to online databases might be through ado,rdo,odbc,oledb interfaces etc.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment