无法将 MySQL 日期/时间值转换为 System.DateTime [英] Unable to convert MySQL date/time value to System.DateTime
问题描述
我收到此错误:
无法将 MySQL 日期/时间值转换为 System.DateTime
Unable to convert MySQL date/time value to System.DateTime
当我试图从 MySQL 数据库中获取数据时.我的 MySQL 数据库中有 date 数据类型.但是在将它检索到我的数据表中时,它得到了上面的错误.
while I am trying to fetch the data from a MySQL database. I have the date datatype in my MySQL database. But while retrieving it into my datatable, it get the error above.
我该如何解决这个问题?
How can I fix this?
推荐答案
如果我在谷歌上搜索无法将 MySQL 日期/时间值转换为 System.DateTime",我会看到许多关于从 Visual Studio 访问 MySQL 的问题的引用.这是你的背景吗?
If I google for "Unable to convert MySQL date/time value to System.DateTime" I see numerous references to a problem accessing MySQL from Visual Studio. Is that your context?
建议的一种解决方案是:
One solution suggested is:
这不是错误而是预期的行为.请检查手册下连接选项并设置允许零日期时间"为真,如附件图片,错误就会消失.
This is not a bug but expected behavior. Please check manual under connect options and set "Allow Zero Datetime" to true, as on attached pictures, and the error will go away.
参考:http://bugs.mysql.com/bug.php?id=26054
这篇关于无法将 MySQL 日期/时间值转换为 System.DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!