|
-
Apr 13th, 2004, 03:47 PM
#1
Thread Starter
New Member
IsDBNull
I have some code that checks for a null value
If IsDBNull(Rec1.Fields("new_address2")) = true Then
End If
Everytime this code is reached, even if it is null, it will never step into the If statement. I have tried to look at all the examples on this site but nothing talks about pulling null values from databases and checking them. Thanks
-
Apr 13th, 2004, 03:53 PM
#2
I wonder how many charact
A zero-length string does not equate to DBNull.
Check the example code given at MSDN:
http://msdn.microsoft.com/library/de...afctIsNull.asp
Anyway...
you either have to test for it on the SQL server, or test for it in the VB code...
Testing on the client-side:
VB Code:
If Rec1.Fields("new_address2") = String.Empty Then
Testing on the DB-side:
Code:
new_Address2 varchar(50)= null
VB Code:
If Rec1.Fields("new_address2") Is DbNull.Value Then
Last edited by nemaroller; Apr 13th, 2004 at 03:58 PM.
-
Apr 13th, 2004, 04:07 PM
#3
Thread Starter
New Member
Ok.
I looked at that page and I still have issues. When I step through the code the value of Rec1.Fields("original_address2").Value is {System.DBNull}. How do I do this?
-
Apr 14th, 2004, 06:33 AM
#4
Fanatic Member
i think u are missing 'Value' keyword in ur code.
VB Code:
If IsDBNull(Rec1.Fields("new_address2")[B].Value[/B]) = True Then
End If
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
|