Arianule
Arianule

Reputation: 9063

error with adding existing *.mdf file as an existing item

I have an existing database(myDatabse) that I created with Microsoft Sql Managenent studio and want to add the myDatabse.mdf file as an existing item(with Visual web Developer express edition)

but get the error message "the file cannot be opened because it is using another process. ..."

In my view it is not open or being used and adding a .mdb file didn't give any problems.

Is there another why one should(can) add the database to the App_data folder so that one can establish a connection to the database.

regards

Upvotes: 1

Views: 494

Answers (1)

Software Engineer
Software Engineer

Reputation: 3956

Generally the running sql server service(s) do not allow to copy database files. To copy .mdf file, detach the database:

  1. Open SQL Server Management Studio
  2. Expand Databases
  3. Right-click on your database > point to Tasks > select Detach > click OK
  4. Manually add the file to App_Folder
  5. After copying, go to Management Studio right-click on Databases > Attach > specify database > click Add

Upvotes: 1

Related Questions