MVC保存数据出现:An error occurred while updating the entries. See the inner exception for details.

查看详细信息:datetime2不能插入datetime(大概意思)

其结果,查看了下,我的 class  中 并没有 datetime2,断点了下,发现是  修改时间 为空  ,结果编译运行  是 自动赋值为 默认值  0000-00-00 00:00:00,

数据库字段 也是 datetime,

那么,就直接 在 class  里面的 字段 类型 允许为空, 例如:public DateTime?  CreareDate{get;set;}  价格问号,允许为空,

这样子的话,存入数据时,时间就为空的了

 

感谢:http://blog.csdn.net/u010032207/article/details/53214871

http://blog.sina.com.cn/s/blog_bc5f90cd0102wufh.html

http://bbs.csdn.net/topics/392055909?page=1

posted @ 2017-08-27 11:15  蜗牛的礼物  阅读(733)  评论(0编辑  收藏  举报