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

From Mdidwiki

Jump to: navigation, search

After copying a MySQL database or performing certain tasks on it, you may receive the following exception in MDID2:

Description: An unhandled exception occurred during the execution of the current web request. 
Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.Types.MySqlConversionException: 
Unable to convert MySQL date/time value to System.DateTime

In certain versions of MySQL, the invalid timestamp "0000-00-00 00:00:00" may be inserted, which causes the exception.

To fix this problem, either replace all invalid timestamps with NULL or a valid timestamp, or add

Allow Zero Datetime=true

to your database connection string in config.xml.

Personal tools