gpt4 book ai didi

c# - NHibernate 无法将 MySQL 日期/时间值转换为 System.DateTime

转载 作者:可可西里 更新时间:2023-11-01 06:35:44 24 4
gpt4 key购买 nike

我收到“无法将 MySQL 日期/时间值转换为 System.DateTime”错误,因为据我所知,我有一条 0000-00-00 00:00:00 的记录。现在,虽然数据永远不应该是那样(它应该是空的),但在某些情况下可能会发生这种情况,我不希望我的整个应用程序因此而崩溃。我正在使用 NHibernate,我尝试添加更改我的连接字符串以允许零日期时间,因此连接字符串配置如下所示:

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

但是我仍然收到该错误。我怎样才能允许 NHibernate 允许时间戳/日期时间/数据/时间的零值?

最佳答案

添加Convert Zero Datetime=true;,可能会有帮助!

关于c# - NHibernate 无法将 MySQL 日期/时间值转换为 System.DateTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4626820/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com