NHibernate的无法MySQL的日期/时间值转换为System.DateTime [英] NHibernate Unable to convert MySQL date/time value to System.DateTime

查看:394
本文介绍了NHibernate的无法MySQL的日期/时间值转换为System.DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到无法MySQL的日期/时间值转换为System.DateTime因为我可以告诉我有0000-00-00 00:00:00记录错误。现在,而数据不应该是(应该为null)有些时候这可能发生,我不希望我的整个应用程序,因为它的崩溃。我使用NHibernate和我尝试添加改变我的连接字符串,允许零日期时间所以连接字符串的配置如下:

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>

不过,我仍然收到这个错误。我怎样才能让NHibernate的允许时间戳/日期/日期/时间零值?

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

推荐答案

添加转换零日期时间= TRUE;!或者,它可以帮助

这篇关于NHibernate的无法MySQL的日期/时间值转换为System.DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆