开发者

Error opening the .mdf file to app_data

I am not able to add .mdf file in App_data(vs 2010 visual studio). If I right click on App_data and try to add existing item and select mydatabase.mdf and click OK I am getting this error:

The file can not be opened because it is used by another process.Please close all applications that might access this file and tr开发者_JAVA百科y again.

But I am just running visual studio.


Not sure if you have found a solution for this, but I just ran into the same problem. I found some relevant info here: How to add a new database under app_data with SQL Server Enterprise Edition

From this I gather that adding new AND existing databases (ie the .mdf file) via VS2010 is not possible.

I'm assuming (for this answer) that your end goal was the same as mine, i.e. to use the Microsoft Entity Framework to generate a model class from the database.

As I didn't want to install SQL express just to do this my solution was: -Create any new db via SQL Server 2008 MGMT studio (or a script if you are that way inclined). -Add a CONNECTION to the database in VS2010 -When adding a new model using the 'Entity Data Model Wizard' select 'Generate from database' and then select your existing connection, and the relevant table(s).

Worked for me!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜