Ankit Ankit - 15 days ago 6
MySQL Question

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

I get this error:


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


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?

Answer

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.

Reference: http://bugs.mysql.com/bug.php?id=26054

Comments