1[SqlException (0x80131904): 拒絕了對對象 '****' (數據庫 '***',架構 'dbo')的 EXECUTE 權限。]
“/”應用程序中的服務器錯誤。
SQL 2012 拒絕了對對象 '***' (數據庫 '****',架構 'dbo')的 EXECUTE 權限。
說明: 執行當前 Web 請求期間,出現未經處理的異常。請檢查堆棧跟蹤信息,以瞭解有關該錯誤以及代碼中導致錯誤的出處的詳細信息。
異常詳細信息: System.Data.SqlClient.SqlException: 拒絕了對對象 '' (數據庫 '',架構 'dbo')的 EXECUTE 權限。
源錯誤:
執行當前 Web 請求期間生成了未經處理的異常。可以使用下面的異常堆棧跟蹤信息確定有關異常原因和發生位置的信息。 |
備註:如果有多個數據庫鏈接,都要檢查對應的數據庫連接串。
2. X.PagedList 如何只獲取一頁的數據?使用類:StaticPagedList
(1)
public class UserController : Controller { public object Index(int? page) { var pageIndex = (page ?? 1) - 1; //MembershipProvider expects a 0 for the first page var pageSize = 10; int totalUserCount; // will be set by call to GetAllUsers due to _out_ paramter :-| var users = Membership.GetAllUsers(pageIndex, pageSize, out totalUserCount); var usersAsIPagedList = new StaticPagedList<MembershipUser>(users, pageIndex + 1, pageSize, totalUserCount); ViewBag.OnePageOfUsers = usersAsIPagedList; return View(); } }
(2)
@model X.PagedList.IPagedList<Model123>
@using System.Web.Optimization
@using X.PagedList.Mvc
@Html.PagedListPager(Model, page => Url.Action("Author", new { page }))
3.Templates can be used only with field access, property access, single-dimension array index, or sing
var tmpDate = item.PoesyDate.ToString("yyyy-MM-dd"); @Html.DisplayFor(modelItem => tmpDate)|
4.Exeption handle:
(1)Application_Error:can't catch 404 error for static files such as html/jpg/JS
(2)if set up Application_Error,[ <customErrors mode="On" defaultRedirect="Error"/>] will not work
(3)HandleErrorAttribute will only control error
4.Get 404 code in MVC: (HttpException)ex).GetHttpCode()