Visual Studio 2012 MVC Local DB Add table menu option missing

Usually connect to an external database, but I wanted to play around with creating a project with a local database. I am using a local SQLServer Express database, not CE.

I can add tables with EF, but if I right-click on the tables in Server Explorer, I only have the Refresh and Properties options, i.e. there is no menu option "Add table". Similarly, if I right-click on one of the tables created by EF, I also get only the Refresh and Properties menu options, so I cannot add rows, etc. A similar problem with stored procedures; I can’t add any (if I want to do some testing with EF and stored procedures) because I only have the Update and Properties menu items.

FOLLOWING: I highlighted this issue for VS2012 Professional. When I use VS2010, it works exactly as expected: I can add tables and stored procedures. After performing the same actions with VS2012, a situation arises when there is no menu option for adding tables or stored procedures. I prepared these test results using SQLServer 2012 LocalDB.

+2
source share
3 answers

If you see only Refresh and Properties, when you right-click on tables in Server Explorer, you probably need to install SQL Server data tools from http://msdn.microsoft.com/en-us/data/hh297027 .

+9
source

I had a similar problem only with Visual Studio 2012 Express for Web, and also with "Getting Started with ASP.Net MVC3" at www.asp.net. The tutorial used the version of Sql Server Compact, but I have SQL Express 2012, so I changed the connection string to indicate the data source in my local instance. \ SQLExpress2012. The application worked perfectly and skillfully read and write to the database. However, I could not edit the database in Visual Studio Express Database Explorer (all parameters of the context menu were missing, except for "refresh" and "properties").

I found that changing the data source in the connection string to " Data Source = (LocalDB) \ v11.0; " fixes the problem. I read somewhere that if you use LocalDb instead of the instance name of SQL Server, then it will be available under your user account - there must be some issue with permissions.

The whole (working) connection string: "Data source = (LocalDB) \ v11.0; AttachDBFilename = | DataDirectory | Movies.mdf; Integrated Security = True;"

Hope this saves someone a bunch of hours pulling hair, I'm almost bald now :)

+1
source

I found that when installing Visual Studio 2013, I did not request the SQL Server Data Tools feature.

By restarting the installer from Control Panel> Programs and Features, using the Modify option, I could add a missing feature. Upon completion, the menu item "Add a new table" was available.

+1
source

All Articles