码迷,mamicode.com
首页 > 数据库 > 详细

Unable to convert MySQL date/time value to System.DateTime

时间:2016-01-22 18:04:46      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

当使用.NET connector 连接MYSQL数据库,检索某些数据的时候,你可能会得到一个错误信息:

"Unable to convert MySQL date/time value to System.DateTime"

这是因为在日期列中有"0000-00-00"数据值,要修正这个问题,你可以把这些数据设为null,或者在连接字符串中设置"Allow Zero Datetime=True"

 

例:

<add name="MySqlCon" connectionString="Database=test;Data Source=localhost;User Id=root;Password=123456;pooling=false;CharSet=utf8;Port=3306;allow zero datetime=true"/>

Unable to convert MySQL date/time value to System.DateTime

标签:

原文地址:http://www.cnblogs.com/hailexuexi/p/5151677.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!