MVC3 Music Store Tutorial Connector Problem

I am working on an MVC Music Store tutorial and run into a problem when I try to connect to a database using an entity model. I have tried a number of these step-by-step instructions, and I continue to encounter problems when I get to this part.

I do not want to use SQL Compact Edition (although I tried to install it only for the tutorials to work). Rather, I have SQL Server Developer 2005 Edition, as well as a named instance of SQL2008 Express (again, it is installed only to find out if I can get the tutorial to work). Here is my connection string:

<connectionStrings> <add name="MusicStoreEntities" connectionString="server=2-BQZ5DP1\DELS2008EXPRESS;Integrated Security=SSPI;database=MvcMusicStore"/> </connectionStrings> 

The closing tag for the connectionStrings element will not be published in the code snippet, so pretend it is.

What do I need to do differently? 2-BQZ5DP1 is the name of my window, and the SQL Express instance is the named instance.

+1
source share
3 answers

Typically, you need MultipleActiveResultSets = True with the Entity Framework when you are using non-Compact SQL Server editions. Depending on what you see, this may be your problem. For more information on connection string options, see this blog post:

http://blogs.msdn.com/b/aspnetue/archive/2012/08/14/sql-server-connection-strings-for-asp-net-web-applications.aspx

+1
source

You may not have a username and password from the conn string? The application and timeout are other parameters that you may need depending on your setup. http://www.connectionstrings.com for more help on SQL 2005.

In addition, the Entity Framework requires much more options in the connection string. I have not used the first approach to the code yet, but if you have existing tables that you want to display, EF has a wizard that you can use to identify the database objects that you want to work with. To achieve this, you must specify the correct connection string in the dialog box. In doing so, VS will populate your web.config with a well-formed and fully built link for use with EF.

0
source

What about

 ConnectionString="Data Source=.\DELS2008EXPRESS; Initial Catalog=MvcMusicStore; Integrated Security=SSPI;" 
0
source

All Articles