MVC Database Connectivity Issues

Source: Internet
Author: User
Tags sql server management

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.