How to connect to SQL Server Express DB from Server Explorer VS 2010?

烂漫一生 提交于 2019-12-06 11:06:44

When you say I can connect to DB using SSMS at the same time this sounds to me as if you've attached the database to SQL Server Express, and you're talking to it through its logical database name.

When you have done this (which is the best approach, in my opinion), then SQL Server (Express) is using that file and controls all access to it; you cannot just reference the .mdf file from your VS solution - you need to use the SQL Server approach and connect to the SQL Server (Express) instance and pick the database:

Select

  • Microsoft SQL Server (SqlClient) from the Data Source dropdown (NOT something like "database file")
  • the server name and instance you want to use (typically: .\SQLExpress - the SQLExpress instance on your local machine)
  • the database from the Select or enter a database name dropdown

  • DO NOT use anything that has to do with "attach database file" or anything like that

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!