[Mono-list] Patch for System.Data.DataRow.cs
Francisco Figueiredo Jr.
fxjrlists@yahoo.com.br
Sun, 01 Jun 2003 12:46:03 -0300
Hi guys,
I created this fix when I was doing some tests with Npgsql.
DataRow only says a field has a null value when it is null, but also
has the option of it not be null and hold the DBNull.Value which also
says a field is null.
So I added the check.
====================================
Index: DataRow.cs
===================================================================
RCS file: /mono/mcs/class/System.Data/System.Data/DataRow.cs,v
retrieving revision 1.37
diff -u -r1.37 DataRow.cs
--- DataRow.cs 4 Apr 2003 19:07:33 -0000 1.37
+++ DataRow.cs 31 May 2003 18:10:07 -0000
@@ -693,7 +693,8 @@
/// </summary>
public bool IsNull (DataColumn column)
{
- return (this[column] == null);
+ Object data = this[column];
+ return (data == null || data == DBNull.Value);
}
/// <summary>
@@ -702,7 +703,8 @@
/// </summary>
public bool IsNull (int columnIndex)
{
- return (this[columnIndex] == null);
+ Object data = this[columnIndex];
+ return (data == null || data == DBNull.Value);
}
/// <summary>
@@ -710,7 +712,8 @@
/// </summary>
public bool IsNull (string columnName)
{
- return (this[columnName] == null);
+ Object data = this[columnName];
+ return (data == null || data == DBNull.Value);
}
/// <summary>
@@ -719,7 +722,8 @@
/// </summary>
public bool IsNull (DataColumn column, DataRowVersion version)
{
- return (this[column, version] == null);
+ Object data = this[column, version];
+ return (data == null || data == DBNull.Value);
}
/// <summary>
================================
--
Regards,
Francisco Figueiredo Jr.
------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi