EntityCommandExecutionException in MVC3

本文关键字:MVC3 in EntityCommandExecutionException | 更新日期: 2023-09-27 18:34:46

我正在尝试使以下函数工作,并不断收到EntityCommandExecutionException错误。我不知道错误是什么意思,并且一直在尝试解决问题无济于事。功能非常基本...

    public Weeks getWeekById(int id)
    {
        Weeks week = database.Weeks.Where(w => w.id == id).SingleOrDefault();
        return week;
    }

在数据库中,我有一个名为 Week 的表,在这两个字段中,一个 int id 字段和一个字符串名称字段。我什至尝试了调用字符串的"getWeekByName"方法,并得到了同样的错误。我有很多函数,具有完全相同的语法在其他表上工作,例如...... public Facility getFacilityById(int id({ 设施设施 = 数据库。Facility.Where(f => f.id == id(.SingleOrDefault((; 退货设施; }

谁能告诉我到底出了什么问题,我该如何解决它?

干杯

EntityCommandExecutionException in MVC3

尝试更新实体模型。它可能会有所帮助