Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL server won't open DB created by Visual Studio

I've built an ASP.Net site in Visual Studio, and created the DB inside it (the .mdf file is in the APP_data folder).

Now, when I want to deploy in the customer site, I think about maintaining the DB without open Visual Studio, and by using the SQL Server Express tools (back up etc.).

I've searched how to do this, and learned that I should attach the .mdf file to sql server.

I've tried to do this and failed!

The error is: Unable to open the physical file "< .mdf >". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)

Google didn't helped me to solve the problem.

Now I have 2 options: 1. To give up and deploy the site in the current situation where the DB is an .mdf file and ASP.Net can connect to it by the SQL server express compact (in the proccess).

  1. To extract all the data (I need to think how...) and import it to new DB, this time in SQL Server DB.

Wat would you recommend doing?

Thank you in advance.

like image 703
Roy Tsabari Avatar asked Jan 08 '10 01:01

Roy Tsabari


1 Answers

If on Windows Vista or higher, try opening SQL Server Management Studio by right clicking and saying "Run as Administrator". As Mitch mentioned maybe it is just a permissions issue. Then try attaching to the database.

like image 67
Jason Rowe Avatar answered Oct 13 '22 10:10

Jason Rowe