我正在使用 ibatis 和 C#。我从将 CreatedDate 作为字段之一的选择查询中获得结果。 Mysql中CreatedDate的Datatype是Date。我将选择查询的结果集分配给一个 Ilist
此处的 DeliveryClass CreatedDate 为 DateTime。当我运行该应用程序时,我得到无法将 MySQL 日期/时间值转换为 System.DateTime。可能是什么问题?
最佳答案
MySqlConnection connect = new MySqlConnection("server=localhost; database=luttop; user=root; password=1234; pooling = false; convert zero datetime=True");
将 convert zero datetime=True
添加到连接字符串会自动将 0000-00-00
日期值转换为 DateTime.MinValue()
.
解决了
关于c# - 无法将 MySQL 日期/时间值转换为 System.DateTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2934844/