NHibernate Unable to convert MySQL datetime value to System.DateTime

I get the message "Unable to convert MySQL date / time value to System.DateTime", because from what I can say, I have a record from 0000-00-00 00:00:00. Now that the data should never be that way (it should be null), there are times when this can happen, and I don’t want my whole application to crash because of this. I am using NHibernate, and I tried adding my connection string to allow zero datetime, so the connection string configuration looks like this:

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

However, I still get this error. How can I enable NHibernate to allow null values ​​for timestamp / datetime / data / time?

+7
source share
1 answer

Add Convert Zero Datetime=true; , this can help!

+14
source

All Articles