Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Pobst <monkey@jpobst.com>2011-07-08 01:50:49 +0400
committerJonathan Pobst <monkey@jpobst.com>2011-07-08 01:50:49 +0400
commit8dd0c2a7b02100fba96213f2bae5affdb831767f (patch)
tree9e323f060efdc7c4ab990182ace53a52cbe59e15 /mcs/class/WebMatrix.Data
parent01daae3e1d43f79a7d699529d1c9bf1be2349636 (diff)
Handle DBNull's.
Diffstat (limited to 'mcs/class/WebMatrix.Data')
-rw-r--r--mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs21
1 files changed, 18 insertions, 3 deletions
diff --git a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
index 417c3e43635..971f7c5db98 100644
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
@@ -52,13 +52,23 @@ namespace WebMatrix.Data
public object this[string name] {
get {
- return fields[name];
+ var retval = fields[name];
+
+ if (retval == DBNull.Value)
+ return null;
+
+ return retval;
}
}
public object this[int index] {
get {
- return fields[Columns[index]];
+ var retval = fields[Columns[index]];
+
+ if (retval == DBNull.Value)
+ return null;
+
+ return retval;
}
}
@@ -69,7 +79,12 @@ namespace WebMatrix.Data
public override bool TryGetMember (GetMemberBinder binder, out object result)
{
- return fields.TryGetValue (binder.Name, out result);
+ bool success = fields.TryGetValue (binder.Name, out result);
+
+ if (result == DBNull.Value)
+ result = null;
+
+ return success;
}
AttributeCollection ICustomTypeDescriptor.GetAttributes ()