|
-
Dec 19th, 2007, 04:11 AM
#1
Thread Starter
Member
[RESOLVED] Problem with VBNULL
If rsAttrib("Description").Value <> vbNull Then
strCondDesc = rsAttrib("Description").Value
End If
Above code is wrttten in vb6.0
Datatype for Column Description is varchar and above code works fine except one case.
If value of Description is “1” then it won’t enter the If block as in visual basic 6.0 VBNULL is enumeration and its value is 1. I want it to execute for 1 also.
Please give me some suggestion.
how can i handle this.
Last edited by Hack; Dec 19th, 2007 at 08:08 AM.
Reason: Added RESOLVED to thread title and green resolved checkmark
-
Dec 19th, 2007, 04:14 AM
#2
Re: Problem with VBNULL
Empty uninitialized string is vbNullString. This is equivalent of NULL in C.
You can also check for empty string by using LenB(strText) = 0 - this is actually faster than checking for vbNullString.
-
Dec 19th, 2007, 04:21 AM
#3
Thread Starter
Member
Re: Problem with VBNULL
rsAttrib is recordset. and if the value is Null in Description , if you try to assign it to some variable it gives error. Even finding length won't work in this case.
I tried to compare with vbNullString, but vbNullString is empty string not NULL.
-
Dec 19th, 2007, 04:36 AM
#4
Re: Problem with VBNULL
In that case: you're getting a Variant. With Variants you can use:
If IsNull(rsAttrib("Description").Value) Then
You can also find IsEmpty and some other functions that only work with Variants. You can find these by opening up the Object Browser by pushing F2.
(I'm not too familiar with recordsets.)
-
Dec 19th, 2007, 04:47 AM
#5
Thread Starter
Member
Re: Problem with VBNULL
Hey Thanks.
It's working
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
|