|
-
May 20th, 2003, 06:41 PM
#1
Thread Starter
Addicted Member
test for null
Anyone know how to test for a null value being returned from a database query
i tried the code below but think i had too much beer over the long weekend because it should be easy but i can't locate the middle portion of my brain
Code:
If myDataSet.Tables(0).Rows(0).Item("Contact") Is Not System.DBNull Then
contactTemp = ""
End If
thanks for any help
Soylent Green tastes like chicken
-
May 20th, 2003, 06:46 PM
#2
Frenzied Member
do a search on the IsDBNull Function
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
May 20th, 2003, 07:01 PM
#3
Frenzied Member
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
May 20th, 2003, 10:20 PM
#4
Fanatic Member
You need to understand that DBNull is very different from empty string (""). Numeric fields for example can be DBNull but cannot be "". Also a lot of controls will choke if you are trying to stick datarow fields into them if the field is DBNull, but will work fine if it is "".
-
May 21st, 2003, 09:50 AM
#5
Sleep mode
Use IsNull function existed in the Rows Obj . Something like this :
VB Code:
If ds.Tables(0).Rows(0).IsNull(0) Then
-
May 21st, 2003, 01:58 PM
#6
I wonder how many charact
VB Code:
If myDataSet.Tables(0).Rows(0).Item("Contact") Is DBNull.Value Then
'you have a null value
-
May 21st, 2003, 03:27 PM
#7
Thread Starter
Addicted Member
Thanks for the help everyone!
nemaroller ... used yours and worked like a charm
Soylent Green tastes like chicken
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|