今天在做一个C#连接MYSQL数据库,并读取数据库的内容,遇到了0000-00-00日期转换报错:unable to convert MySQL date/time value to System.DateTime

百度了很多帖子都是让在连接字符串里加上:Allow Zero Datetime=True;

但是我加上了还是报错,后来GOOGLE了一下,在一个国外论坛的帖子上发现这么一句话:

Because 0000-00-00 00:00:00 is not valid .Net DateTime (minimum value is 00:00:00.0000000, January 1, 0001)

Add this to the connection string :

Allow Zero Datetime=true and Convert Zero Datetime=true

原来还要加上Convert Zero Datetime=true,晕,终于解决了。。。

C#操作MYSQL遇到0000-00-00日期报错的原因的更多相关文章

  1. 通俗易懂地解决中文乱码问题(2) --- 分析解决Mysql插入移动端表情符报错 ‘incorrect string value: '\xF0...

    原文:[原创]通俗易懂地解决中文乱码问题(2) --- 分析解决Mysql插入移动端表情符报错 'incorrect string value: '\xF0... 这篇blog重点在解决问题,如果你对 ...

  2. MySQL中遇到的几种报错及其解决方法

    MySQL中遇到的几种报错及其解决方法 1.[Err] 1064 - You have an error in your SQL syntax; check the manual that corre ...

  3. 【mybatis】【mysql】mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains no ...

  4. 安装mysql驱动之 mysqlclient 出现的报错处理(ubuntu16.04)

    首先 更新软件! sudo apt-get update 然后尝试安装mysqlclient,报错 后执行下面的步骤 安装mysql驱动之 mysqlclient 出现的报错信息处理 报错1: OSE ...

  5. kali linux 安装 Mysql Can't read from messagefile 报错解决方案

    1.下载安装包 下载地点:https://dev.mysql.com/downloads/mysql/ 或者 wget http://dev.mysql.com/get/Downloads/MySQL ...

  6. Sqoop- sqoop将mysql数据表导入到hive报错

    sqoop将mysql数据表导入到hive报错 [root@ip---- lib]# sqoop import --connect jdbc:mysql://54.223.175.12:3308/gx ...

  7. 【mysql】 load local data infield 报错 ERROR 1148 (42000): The used command is not allowed with this MySQL version

    mysql> load data local infile '/Users/flint/learn/mysql/pet' into table bx_pet; 执行报错 ERROR 1148 ( ...

  8. mysql修改后启动my.cnf报错Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

    mysql中文乱码解决 mysql修改my.cnf后启动报错Starting MySQL... ERROR! The server quit without updating PID file (/v ...

  9. SpringBoot配置JDBC连接MySql数据库的时候遇到了报错:HikariPool-1 - Exception during pool initialization

    使用SpringBoot做JAVA开发时,JDBC连接MySql数据库的时候遇到了报错: ERROR 10392 --- [ main] com.zaxxer.hikari.pool.HikariPo ...

随机推荐

  1. 习题二:string数组应用

    说明: 读字符串char buf[100]="xxx:yyy:zzz:aaa:bbb" 按“:”进行分解到string数组中去 逻辑: 通过指针遍历整个字符串 遇到'\0'表示字符 ...

  2. iOS程序-UIScrollView的基本使用

    iOS程序-UIScrollView的基本使用 scrollView的几个属性contentSize contentOffset contentInset 1.不能向上滑动很可能是因为contentS ...

  3. 之前C#代码的重新设计

    /* 我用python重构了一把这个代码 大家的反应似乎是过度设计了 好吧,我决定不那么激进,采用更中庸一些的重构 我也有些疑惑: 是否如果重构后的代码比重构前要多,就算过度了呢? */ void m ...

  4. TextView 设置超过几行后显示省略号

    android:lines="5" android:ellipsize="end"

  5. Minimum Path Sum——LeetCode

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...

  6. 挂载nfs系统问题之: Root-NFS: Server returned error -13 while mounting

    今天换了个路由器,由于是自动分的IP,现在的IP和之前的不在同一网段.以前是192.168.0.xxx,现在是192.168.1.xxx.本以为将serverip,ipaddr,bootargs这些参 ...

  7. Android 各版本信息 (维基百科)

    The following tables show the release dates and key features of all Android operating system updates ...

  8. STL_iterator迭代器(3)——函数和函数对象

    STL中,函数被称为算法,也就是说它们和标准C库函数相比,它们更为通用.STL算法通过重载operator()函数实现为模板类或模板函数.这些类用于创建函数对象,对容器中的数据进行各种各样的操作.下面 ...

  9. C++ STL之string常用指令

    string,大小可变的字符串,有些类似于C中的字符数组. 只记载本人在ACM中常用的函数,并且全部经过程序测试. 1.初始化 string s1;——默认构造函数s1为空串 string s2(s1 ...

  10. Selenium webdriver 查找元素

    1.简单查找 By ID: WebElement element=driver.findElement(By.id("userId")); By Name:WebElement e ...