[Mono-dev] [Mono-patches] r107145 - trunk/mcs/class/System.Data/System.Data

Gert Driesen gert.driesen at telenet.be
Thu Jul 3 12:19:04 EDT 2008


Hey Veerapuram,

I don't think this change is correct. I've done some more tests, and this is
the behavior I'm seeing:

* on 1.0 profile, you are never allowed to set value to NULL.
* on 2.0 profile, you are only allowed to set value to NULL if the column is
backed by a reference type.

I'll add unit tests for this to DataRowTest2.cs in a few minutes, and mark
them NotWorking.

Let me know if you want me to submit a patch that changes our implementation
accordingly.

Gert

-----Original Message-----
From: mono-patches-bounces at lists.ximian.com
[mailto:mono-patches-bounces at lists.ximian.com] On Behalf Of Veerapuram
Varadhan (vvaradhan at novell.com)
Sent: donderdag 3 juli 2008 15:38
To: mono-patches at lists.ximian.com; ximian.monolist at gmail.com;
mono-svn-patches-garchive-20758 at googlegroups.com
Subject: [Mono-patches] r107145 - trunk/mcs/class/System.Data/System.Data

Author: varadhan
Date: 2008-07-03 09:38:09 -0400 (Thu, 03 Jul 2008)
New Revision: 107145

Modified:
   trunk/mcs/class/System.Data/System.Data/ChangeLog
   trunk/mcs/class/System.Data/System.Data/DataRow.cs
Log:
Use DBNull value instead of throwing an exception


Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog	2008-07-03 13:37:14
UTC (rev 107144)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog	2008-07-03 13:38:09
UTC (rev 107145)
@@ -1,3 +1,7 @@
+2008-07-03  Marek Habersack  <mhabersack at novell.com>
+
+	* DataRow.cs (this []): Use DBNull instead of throwing an exception
+	
 2008-07-01  Rodrigo Kumpera  <rkumpera at novell.com>
 
 	* DataTable.cs: Kill some foreach loops.

Modified: trunk/mcs/class/System.Data/System.Data/DataRow.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/DataRow.cs	2008-07-03 13:37:14
UTC (rev 107144)
+++ trunk/mcs/class/System.Data/System.Data/DataRow.cs	2008-07-03 13:38:09
UTC (rev 107145)
@@ -178,9 +178,8 @@
 				DataColumn column =
_table.Columns[columnIndex];
 				_table.ChangingDataColumn (this, column,
value);
 				
-				if (value == null && column.DataType !=
typeof(string)) {
-					throw new ArgumentException("Cannot
set column " + column.ColumnName + " to be null, Please use DBNull
instead");
-				}
+				if (value == null && column.DataType !=
typeof(string))
+					value = DBNull.Value;
 				_rowChanged = true;
 				
 				CheckValue (value, column);

_______________________________________________
Mono-patches maillist  -  Mono-patches at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches



More information about the Mono-devel-list mailing list