Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting MySQL DATETIME to System.DateTime

I am using a MySQL database with DbLinq, but there is an exception being thrown:

"Cannot convert mysql datetime to system.datetime"

How can I resolve this issue?

like image 979
pius Avatar asked Sep 12 '26 10:09

pius


2 Answers

Check for any zero date means date like '0000-00-00' in database; this could be the cause of error.

like image 136
John Avatar answered Sep 14 '26 23:09

John


Either cast the MySqlDateTime as a DateTime or use mySqlDateTime.GetDateTime().

like image 24
user239412 Avatar answered Sep 15 '26 01:09

user239412