我正在尝试为部门名称制作下拉列表.我正在使用MVC5.我在堆栈溢出上看到了太多的解决方案,但我从未找到与MVC5相关的有价值的解决方案.
Database Name : AppraisalDBContext
Table Name : Department
Column Name : deptID (Primarykey)
deptName (department name)
Description
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: The model backing the 'AppraisalDBContext' context has changed since the database was created.Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?
Run Code Online (Sandbox Code Playgroud)
码:
控制器类名称(DepartmentController.cs):
public ActionResult Index(string depName)
{
var DeptLst = new List<string>();
var GenreQry = from d in db.Department
orderby d.deptName
select …Run Code Online (Sandbox Code Playgroud)