[Mono-bugs] [Bug 73157][Nor] New - ODBC type SQL_NUMERIC gives InvalidCastException

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 1 Mar 2005 13:13:19 -0500 (EST)


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@pokorra.de.

http://bugzilla.ximian.com/show_bug.cgi?id=73157

--- shadow/73157	2005-03-01 13:13:19.000000000 -0500
+++ shadow/73157.tmp.14363	2005-03-01 13:13:19.000000000 -0500
@@ -0,0 +1,42 @@
+Bug#: 73157
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: timo-mono@pokorra.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ODBC type SQL_NUMERIC gives InvalidCastException
+
+When reading from an ODBC Source that has a column with type SQL_NUMERIC,
+and casting the value to System.Double, you get a
+System.InvalidCastException exception.
+
+Steps to reproduce the problem:
+1. Access a DataReader, that points to a row with a column of the ODBC type
+SQL_NUMERIC.
+2. Try to cast the value to System.Double
+System.Double numeric_value_n = (System.Double) reader["numeric_value_n"];
+3. You will get System.InvalidCastException 
+
+Actual Results:
+The value is returned as a string. 
+The following line works:
+string numeric_value_n = (string) reader["numeric_value_n"];
+
+Expected Results:
+The value should be returned as a double.
+
+Additional Information:
+In mcs\class\System.Data\System.Data.Odbc\OdbcDataReader.cs, 
+col.OdbcType has the correct type OdbcType.Numeric
+But the appropriate case statement is missing 
+and that means the value is treated like a string in the default clause.