Menu

#107 The DateTime represented by the string is out of range

open
nobody
None
5
2004-04-23
2004-04-23
Anonymous
No

When reading a datareader containing a MySQL DATE
field, it will throw an System.FormatException when an
invalid date is encountered, ex. February 30, September
31.
The exception is not thrown, as would be expected,
when doing getDateTime, but rather on
ByteFX.Data.MySqlClient.MySqlDataReader.Read()

Example
sql="SELECT born_date FROM table";
// Connecting etc.
result=dbcmd.ExecuteReader();
result.Read(); // Exception on invalid dates

Maybe this is by design, but it seems more natural to me
to throw the exception when actually trying to read the
offending field.

regards
SR
stein@hokum.net

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.