ado.net 读取mysql, Unable to convert MySQL date/time value to System.DateTime 错误

mysql中datetime的缺省值会设定为0000-00-00/0000-00-00 00:00:00,.net中是0001-00-00/0000-00-00 00:00:00,

因此当.net试图转换时候会出现异常。


解决办法:

在mysql connectionstring中添加选项:Convert Zero Datetime=True;  并且移除 Allow Zero Datetime=True;选项

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章