Ank*_*han 80 .net mysql asp.net asp.net-3.5
我收到此错误:
无法将MySQL日期/时间值转换为System.DateTime
而我正在尝试从MySQL数据库中获取数据.我的MySQL数据库中有date数据类型.但是在将其检索到我的数据表中时,它会得到上面的错误.
我怎样才能解决这个问题?
小智 191
您必须添加Convert Zero Datetime=True到您的连接字符串,例如:
server=localhost;User Id=root;password=mautauaja;Persist Security Info=True;database=test;Convert Zero Datetime=True
Run Code Online (Sandbox Code Playgroud)
dkr*_*etz 47
如果我谷歌"无法将MySQL日期/时间值转换为System.DateTime",我看到许多引用从Visual Studio访问MySQL的问题.这是你的背景吗?
一个解决方案建议:
这不是一个错误,而是预期的行为.请检查连接选项下的手动并将"允许零日期时间"设置为true,如附加图片所示,错误将消失.
参考:http://bugs.mysql.com/bug.php?id = 26054
| 归档时间: |
|
| 查看次数: |
114801 次 |
| 最近记录: |