Please sorry for my English http://dev.mysql.com/doc/connector-net/en/connector-net-programming-datetime-null.html Apparently .NET can't take 0000-00-00 date. Im try to use code from page in my code:
for (int i = 0; i < dataReader.FieldCount; i++) list.Add(new List<string>());
DateTime myTime;
try
{
//Read the data and store them in the list
while (dataReader.Read())
{
for (int i = 0; i < dataReader.FieldCount; i++)
{
if (tablename == "orders")
{
if (dataReader.IsDBNull(dataReader.GetOrdinal("sell_date"))) MessageBox.Show("111");
}
list[i].Add(dataReader[i] + "");
}
}
}
catch(Exception e)
{
MessageBox.Show("Ошибка: " + e.GetType().ToString() + "\nСообщение: " +e.Message.ToString());
}
Same error: Error: MySql.Data.Types.MySqlСonversionException Message: Unable to convert MySQL date/time value to System.DateTime
Why MessageBox.Show("111"); don't work? Field sell_date is contain 0000-00-00
0000-00-00 is not a valid DateTime value
To resolve this issue you have to configure the MySQL .NET Connector ( here you can find all parameters ).
You have two ways:
I prefer the second.... I hope this will be useful for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.