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

时间:2017-08-27 11:30:39   收藏:0   阅读:13646

查看详细信息: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

原文:http://www.cnblogs.com/dzw159/p/7439885.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!