An error occurred while updating the entries. See the inner exception for details.

EF插入或更新数据时出现错误提示:An error occurred while updating the entries. See the inner exception for details.的解决办法。

原因一:数据库字段类型为datetime已设置默认值(getdate()).但EF插入和更新的时候是没有主动设置其值,程序自动赋值为“0000-00-00 00:00:00”,所以造成的错误。

解决办法:已设置默认值datetime类型的字段,EF插入和更新前必须先主动赋值。

posted @ 2018-03-23 09:26  yuejin  阅读(3514)  评论(0编辑  收藏  举报