Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am getting the "Unable to convert MySQL date/time value to System.DateTime" error because from what I can tell I have a record with 0000-00-00 00:00:00. Now while the data should never be that (it should be null) there are cases when this might happen and I don't want my entire application to crash because of it. I am using NHibernate and I tried adding change my connection string to allow zero datetime so the connection string configuration looks like:

<property name="connection.connection_string">
 Server=localhost;Database=user_system;User ID=root;Password=root;
   Allow Zero Datetime=true;
</property>

However I still receive that error. How can I allow NHibernate to allow zero values for timestamp/datetime/data/time?

like image 528
ryanzec Avatar asked Jan 07 '11 15:01

ryanzec


1 Answers

Add the Convert Zero Datetime=true;, it may help!

like image 186
Jahan Zinedine Avatar answered Nov 14 '22 23:11

Jahan Zinedine