[Mono-bugs] [Bug 75040][Nor] New - OdbcDataAdapter.Fill loses row
when DateTime column is NULL
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed May 25 10:04:03 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by timo-mono at pokorra.de.
http://bugzilla.ximian.com/show_bug.cgi?id=75040
--- shadow/75040 2005-05-25 10:04:03.000000000 -0400
+++ shadow/75040.tmp.26294 2005-05-25 10:04:03.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 75040
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: timo-mono at pokorra.de
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: OdbcDataAdapter.Fill loses row when DateTime column is NULL
+
+Description of Problem:
+When running an sql query and filling the result into a DataSet, using an
+OdbcDataAdapter, and one of the date values is DBNull, you get an
+exception. The exception is not visible on the console, but the whole row
+is disregarded.
+
+Steps to reproduce the problem:
+sAdapter = new OdbcDataAdapter("SELECT dateColumn FROM myTable WHERE
+dateColumn IS NULL", dbcon);
+sAdapter.Fill(AddressDataSet, "Addresses");
+
+Actual Results:
+System.InvalidCastException: Cannot cast from source type to destination type.
+in <0x00082> System.Data.Odbc.OdbcDataReader:GetDateTime (Int32 ordinal)
+
+Expected Results:
+Should return an empty time value (new DateTime())
+
+How often does this happen?
+always
+
+Additional Information:
+possible Solution:
+In OdbcDataReader.cs:
+DateTime GetDateTime (int ordinal)
+{
++ if (GetValue(ordinal) == System.DBNull.Value)
++ return new DateTime();
+ return (DateTime) GetValue(ordinal);
+}
+Perhaps in other places as well?
More information about the mono-bugs
mailing list