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
This is my connectionstring:
<add name="gdmwebsiteEntities"
connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;User Id=root;database=gdmwebsite""
providerName="System.Data.EntityClient" />
I've already added "Convert Zero Datetime=True" add the end of my connectionstring but nothing changed.
<add name="gdmwebsiteEntities"
connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;User Id=root;database=gdmwebsite"
Convert Zero Datetime=True
Allow Zero Datetime=True"
providerName="System.Data.EntityClient" />
Is there another method for fixing this?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With