问题描述:

I am using Entity Framework in .NET MVC 3.0 and use Code First method.

And I used a .MDF file for database and also use "DropCreateDatabaseIfModelChanges" to generate database automatically after every change.

My application works correct, but when I open database from Server Explorer in VS, then my application gives an error:

Cannot open database "DB" requested

by the login. The login failed. Login

failed for user 'Mahdi-PC\Mahdi

Could you help me?!

网友答案:

Not sure, but... In the Data Connection dialog have you got the "Data Source" set to "Microsoft SQL Server" - I think you might need to change it to be "Microsoft SQL Server Database File"

相关阅读:
Top