简体   繁体   English

MySQL - 无法序列化日期/时间值

[英]MySQL - Unable to serialize date/time value

Hi I am having a weird issue with MySQL right now. 嗨,我现在有一个奇怪的MySQL问题。 I am executing a MySqlCommand of type stored procedure which has some datetime values in it and I have verified that all date time values are correct. 我正在执行类型存储过程的MySqlCommand,其中包含一些日期时间值,并且我已验证所有日期时间值都是正确的。 But I when I execute this command as cmd.ExecuteNonQuery() it thorws erros as 但是当我以cmd.ExecuteNonQuery()执行此命令时,它会将错误作为错误

"Fatal error encountered during command execution" “在命令执行期间遇到致命错误”

InnerException - InnerException -

"Unable to serialize date/time value" “无法序列化日期/时间值”

I read in some online forums that it is the issue with .NET connector for MySQL and is resolved in version 6.3.3. 我在一些在线论坛上读到这是MySQL连接器的问题,并在6.3.3版本中得到解决。 Well, I am using version 6.5.4 and still facing issue. 好吧,我使用的是6.5.4版,但仍面临问题。 When I pass DateTime.Now as a value everything works well but none of the other date value works. 当我将DateTime.Now作为值传递时,一切正常,但其他日期值都不起作用。

Does anybody know any work around? 有人知道任何工作吗?

I got this error as well and this was one of those things you can search for forever. 我也得到了这个错误,这是你可以永远搜索的东西之一。 I copied the code to add parameters and forgot to change the MySqlDbType to Int32 of that other parameter. 我复制了代码以添加参数,忘了将MySqlDbType更改为其他参数的Int32。 Assuming (stupid me) my date variable in C# was incorrect I was looking for the wrong thing. 假设(愚蠢的我)我在C#中的日期变量不正确我正在寻找错误的东西。

So check again, if you have this, you're probably passing a non date into a parameter that expects a date. 所以再次检查,如果你有这个,你可能会将一个非日期传递给一个期望日期的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM