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

后端 未结 1 358
无人及你
无人及你 2020-12-20 18:57

when I want to load data from my mysql database I always get this error:

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

相关标签:
1条回答
  • 2020-12-20 19:00

    Set both of these configurations in your connection string.

    "Convert Zero Datetime=True"
    "Allow Zero Datetime=True"
    

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

    Please check manual under connect options and set "Allow Zero Datetime" to true, as on attached pictures, and the error will go away.

    Check this also: http://mdid.org/mdidwiki/index.php?title=Unable_to_convert_MySQL_date/time_value_to_System.DateTime_exception

    To fix this problem, either replace all invalid timestamps with NULL or a valid timestamp, or add Allow Zero Datetime=true

    0 讨论(0)
提交回复
热议问题