当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net mvc - Entity Framework Connection Error "Cannot open database "DB" requested by the login. The login failed"

问题描述:

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"

分享给朋友:
您可能感兴趣的文章:
随机阅读: