[Mono-bugs] [Bug 55161][Nor] New - SqlDataReader doesn't contain System.DbNull.Value on ordinal position for a field which is NULL in database

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 4 Mar 2004 11:01:25 -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 frans@sd.nl.

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

--- shadow/55161	2004-03-04 11:01:25.000000000 -0500
+++ shadow/55161.tmp.24427	2004-03-04 11:01:25.000000000 -0500
@@ -0,0 +1,52 @@
+Bug#: 55161
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: XP sp1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data.SqlClient
+AssignedTo: rodrigo@ximian.com                            
+ReportedBy: frans@sd.nl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: SqlDataReader doesn't contain System.DbNull.Value on ordinal position for a field which is NULL in database
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When a row is fetched using the SqlDataReader object in Mono 0.30.x and a
+table field in that row contains NULL, the corresponding ordinal field in
+the SqlDataReader object doesn't contain System.DbNull.Value. It should,
+because it makes porting code over from .NET to Mono much easier. Other
+providers do fill the field with System.DbNull.Value.
+
+Consider this code:
+bool isColumnValueDBNull = (myDataReader[columnOrdinal] ==
+System.DBNull.Value);
+
+This will result in true on .NET 1.1. if the corresponding table field is
+NULL. It will result in false on Mono.
+
+This works on mono however:
+bool isColumnValueDBNull = dataSource.IsDBNull(columnOrdinal);
+
+This code is however very slow on .NET and will probably not used a lot. 
+
+Steps to reproduce the problem:
+1. See code above.
+2. 
+3. 
+
+Actual Results:
+false in check (see above)
+
+Expected Results:
+true in check
+
+How often does this happen? 
+always.