Checking for DBNull throws a StrongTypingException
Posted
by
calico-cat
on Stack Overflow
See other posts from Stack Overflow
or by calico-cat
Published on 2011-01-14T09:29:57Z
Indexed on
2011/01/14
9:53 UTC
Read the original article
Hit count: 232
I am using a dataset to pull data from a DB. One of the fields in a row is NULL
. I know this. However, the following vb.net code throws a StrongTypingException
(in the autogenerated get_SomeField() method in the dataset designer):
If Not IsDBNull(aRow.SomeField) Then
'do something
End If
According to documentation and this question it should be fine.
edit: If aRow.SomeField is DBNull.Value Then
also returns the same error. Argh.
© Stack Overflow or respective owner