Saturday, September 21, 2013

Unable to convert MySQL date/time value to System.DateTime [Solved]

For this solution you must add (Convert Zero Datetime=True or Allow Zero Datetime=True) to your connection string, for example:
server=localhost;User Id=root;password=pass123;Persist Security Info=True;database=test;Convert Zero Datetime=True

or
server=localhost;User Id=root;password=pass123;Persist Security Info=True;database=test;Allow Zero Datetime=True


You can format the date/time data in your sql statement using DATE_FORMAT(date,format) .Actually mysql have a different format (yyyy-mm-dd) for the date/time data type.

Enjoy Programming...