當使用.NET connector 連接MYSQL數據庫,檢索某些數據的時候,你可能會得到一個錯誤信息:
"Unable to convert MySQL date/time value to System.DateTime"
這是因爲在日期列中有"0000-00-00"數據值,要修正這個問題,你可以把這些數據設爲null,或者在連接字符串中設置"Allow Zero Datetime=True"
例:
<add name="MySqlCon" connectionString="Database=test;Data Source=localhost;User Id=root;Password=123456;pooling=false;CharSet=utf8;Port=3306;allow zero datetime=true"/>