20080409 - unable to convert MySQL datetime value to System.DateTime


在用.net 连接mysql 5时,可能出现这样的错误提示:

 "unable to convert MySQL datetime value to System.DateTime";

这个时候可以在连接字符串中添加这样语句:

"Server=localhost;UserId=root;Database=powergsm;allow zero datetime=true";

这样就可以对全0的日期不抛出异常了。

连接字符串中还有另外一个开关Convert Zero Datetime, 则可以对于无法解析的日期值,转化为DateTime.MinValue.

 

posted on 2008-04-09 11:22  Eric Lee  阅读(834)  评论(1编辑  收藏  举报

导航