[Mono-bugs] [Bug 47883][Nor] New - Incorrect comparison in DataRow.cs (Easy to solve)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 20 Jan 2004 08:38:40 -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 sumadevi@novell.com.

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

--- shadow/47883	2004-01-20 08:38:40.000000000 -0500
+++ shadow/47883.tmp.19270	2004-01-20 08:38:40.000000000 -0500
@@ -0,0 +1,46 @@
+Bug#: 47883
+Product: Mono/Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.Data
+AssignedTo: sumadevi@novell.com                            
+ReportedBy: sergio-blanco@iespana.es               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Incorrect comparison in DataRow.cs (Easy to solve)
+
+In DataRow.cs (System.Data) there is a overloaded method:
+
+    public bool IsNull (DataColumn column)
+    {
+      return (this[column] == null);
+    }
+    [more IsNull methods]
+
+It returns true if the column specified of the row is null, otherwise
+returns false. But I've found a problem here, the comparison made is wrong
+, when a column is null it cotains DBNull.Value and not null. 
+
+As we can see, the method SetNull (from DataRow also) that makes a Column
+null, assigns DBNull.Value instead of null:
+
+protected void SetNull (DataColumn column)
+    {
+      this[column] = DBNull.Value;
+    }
+
+So all these methods IsNull (overloaded) must have a comparison like this:
+
+      return (this[column] == DBNull.Value);
+
+------- Additional Comments From sumadevi@novell.com  2004-01-20 08:38 -------
+Created an attachment (id=6471)
+Updated in CVS
+