无法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数据库。但是,当检索到我的数据表,它得到上述错误。
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?
一个解决方案建议是:
这是不是一个错误,但预期 行为。请在手动 连接选项和设置允许零 日期时间为真,作为连接 图片和错误就会消失。
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屋!