MVC4 学习备忘

  1. WebConfig文件里添加数据库链接字符: 

    <add name="MovieDBContext(可以自己取字符串名字)" connectionString="Data Source=(LocalDB)\v11.0; AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>

         如果忘了添加,会报错如下:         

CREATE DATABASE permission denied in database 'master'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.

Source Error: 

Line 19:         public ActionResult Index()
Line 20:         {
Line 21:             return View(db.Movies.ToList());
Line 22:         }
Line 23: 


Source File: d:\My Programming Learned\VS2012\MvcMovie\MvcMovie\Controllers\MoviesController.cs    Line: 21 

2. 

posted on 2014-12-25 16:01  MarkTang  阅读(197)  评论(0编辑  收藏  举报