0

Fix “Unable to convert MySQL date/time value to System.DateTime” exception when using MySQL .NET Connector

Posted by Nantharupan on 2:08 AM in , ,
Recently I developed a WPF MVVM application using MySQL as database. I faced a lot of problems!

One Issues i faced was when i retrieve the data from data base using linq i am getting exception  "Unable to convert MySQL date/time value to System.DateTime". When i checked the data has empty /0000-00-00  as date. When i checked in the internet i found the solution. 

Fix one Change or fix the Dates to a correct date.

Fix Two 

add the following property to connection string 

convert zero datetime=True;

You can set this when you connect to the data base as well. You have to click advanced and make the "convert zero datetime" property true;



0 Comments

Post a Comment

Popular posts

Copyright © 2009 On the way All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.