Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded

时间:2022-04-05 03:17:52

asp.net  更新数据时报错:Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded

原因:Check your object, does it pass Primary Key Null. This Exception is Generally due this reason only.

对象的主键为空,导致不能更新,检查你要更新的对象,查看主键是否为空,或0