我有以下Edit方法:
[HttpPost]
public ActionResult Edit(Movie movie)
{
try
{
_db.ApplyCurrentValues("Movies1",movie);
_db.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
我的错误如下:
<编码> 标语中找不到与所提供物体的关键相匹配的物体。 证明所供应物体的关键价值与必须加以修改的物体的关键价值相符。
两点:
- I did not get the error the first time I did an update, only subsequent updates.
- Movies1 is the the name of the EntitySet when I view the edmx designer. Is this what it shold be or should it be the name of the table (Movie)?
- I have seen things regarding Attach, but I am confused as to what exactly that is.