Blog Park is strong, first affixed to a study address, after all, I will not write so detailed, mainly to record their own learning problems encountered http://blog.csdn.net/itmaxin/article/details/22885451
ASP. NET MVC4.0 Official tutorial Getting Started Guide V-Controller Access model data
1: Access to the model data, always prompted the database connection problem, here to change the Web. config file,
To change the default defaultconnection to Moviedbcontext, the file will be created under App_Data.
<add name="moviedbcontext" connectionstring="Data source= (LocalDb) \ V11.0;initial catalog=aspnet-mvcday1-20160201170527;integrated Security=sspi; attachdbfilename=| Datadirectory|\aspnet-mvcday1-20160201170527.mdf" providername=" System.Data.SqlClient" />
Or connect to your local database.
Where data source= followed to root your database name, vs attempt to have SQL Server management tools, open the F2, and then copy and paste it.
Catalog This is the name of the database to be created
<add name="moviedbcontext" connectionstring="Data source= (localdb) \ Projectsv12;initial catalog=movie;integrated Security=sspi; "providername="System.Data.SqlClient "/>
MVC Database Connectivity Issues