| Bug #29100 | Non sense while retrieving a MySQL datetime with .NET connector | ||
|---|---|---|---|
| Submitted: | 14 Jun 2007 8:41 | Modified: | 19 Jul 2007 6:43 |
| Reporter: | Roberto Taglia | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | Connector / NET | Severity: | S3 (Non-critical) |
| Version: | 5.0.7 | OS: | Windows |
| Assigned to: | CPU Architecture: | Any | |
[19 Jun 2007 6:43]
Tonci Grgin
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to 'Open'. Thank you for your interest in MySQL. Explanation: Hi Roberto and thanks for your report. Please attach following: - my.ini/cnf (if MySQL server is on linux) - Small but complete test case, with DDL & DML statements, exhibiting this error Also, for the sake of completeness, please add info on: - MySQL server version - NET FW version Regards Tonci.
[19 Jul 2007 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[22 Feb 2019 19:02]
Andrew Colombi
12 years later and this is still an issue *facepalm*

Description: Hello, HERE IS THE CODE : ------------------ MySqlDataReader reader; DateTime mydatetime; if( reader.IsDBNull( 4 ) == false ) { MySqlDateTime mysqldatetime = reader.GetMySqlDateTime( 4 ); if( mydt.IsValidDateTime == false ) { // Other processing when DateTime is invalid } else { mydatetime = mysqldatetime.GetDateTime(); } } NOW, IMAGINE THE VALUE NULL FOR DATETIME ---------------------------------------- i check the column with reader.IsDBNull() and all is OK in the previous. NOW, IMAGINE THE VALUE 0000-00-00 00:00:00 FOR DATETIME ------------------------------------------------------- reader.IsDBNull() throws an exception because of invalid DateTime value. SO, I DECIDE TO USE FIRST THE FUNCTION GetMySqlDateTime() --------------------------------------------------------- reader.GetMySqlDateTime() works great with DateTime equals to 0000-00-00 00:00:00 BUT WHEN there is column with NULL vallue, reader.GetMySqlDateTime()throws an exception because it cannot be used with null value. WHAT IS WEIRD IS : ------------------ When you look at the API, the class MySqlDateTime contains a member IsNull. If i cannot retrieve this class by reader.GetMySqlDateTime() when the column contains NULL value, the member MySqlDateTime.IsNull is very USELESS. Thank you How to repeat: See above Suggested fix: See above