MVC3 Music Store Tutorial Connection String issue

前端 未结 3 990
离开以前
离开以前 2021-01-16 04:32

I\'m working my way through the MVC Music Store Tutorial and am running into an issue when I try to connect to the database using the entity framework model. I\'ve tried a

相关标签:
3条回答
  • 2021-01-16 05:07

    how about

    ConnectionString="Data Source=.\DELS2008EXPRESS; Initial Catalog=MvcMusicStore; Integrated Security=SSPI;"
    
    0 讨论(0)
  • 2021-01-16 05:08

    You generally need MultipleActiveResultSets=True with Entity Framework when you're using SQL Server editions other than Compact. Depending on what the error you are seeing is, that might be your problem. For more on connection string options, see this blog:

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

    0 讨论(0)
  • 2021-01-16 05:14

    You could be missing the username and password from your conn string? Application and timeout are other parameters you might need depending on your set up. Check out http://www.connectionstrings.com for more help with SQL 2005.

    Furthermore, Entity Framework requires many more parameters in the connection string. I have not used the code first approach yet but if you have existing tables you wish to map then EF has a wizard you can use to identify the database objects you want to work with. To get this far you have to provide a valid connection string to the dialog. In doing so VS will populate your web.config with the well formed and fully constructed conn string for use with EF.

    0 讨论(0)
提交回复
热议问题