|
|
 |
Re: FN-FORUM ASP code help
date posted 12th September 2002 17:33
Thanks, that's pretty much what I've done now.
I know there's a difference between null and a blank variable, I just would
have expected a len of 0 on both of them.
Dave
----- Original Message -----
From: "John Olival" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Thursday, September 12, 2002 5:19 PM
Subject: Re: FN-FORUM ASP code help
It seems that what's happening here is that the value of strAffiliateID is
Null.
With the Len() function, if the string you're checking contains Null, then
Len() returns Null. So when you check
len( trim( strAffiliateID)) it returns Null, not 0.
To fix this change the If...Then statement to:
If (len( trim( strAffiliateID)) = 0) Or
(IsNull(len(trim(strAffiliateID)))) Then
Response.Write( "None")
Else
Response.Write( strAffiliateID & "hello")
End If
and you should get the result you're looking for.
Null means that the item contains no valid data - not the same as blank.
HTH
JohnO
---
John Olival
Explican Ltd. Internet Consultants
+44 (0)7980 834 217
http://www.explican.com
> strAffiliateID = RecordSet.Fields("fldAffiliateID")
> Response.Write( "*" & len( trim( strAffiliateID)) & "*")
> Response.Write( "*" & strAffiliateID & "*")
>
> If len( trim( strAffiliateID)) = 0 Then
> Response.Write( "None")
> Else
> Response.Write( strAffiliateID & "hello")
> End If
> %>
>
>
> Output:
>
> ****hello
============================================================
= Advanced web hosting solutions from Saffas. =
= Unix, PHP, mySQL, SSL, Perl, Control Panel, 24/7 access. =
= Why pay more for less? http://www.saffas.com =
============================================================
Sponsor the forum for as little as £1 at:
http://www.freelancers.net/cgi/sponsor.cgi?action=show
Advertise with Freelancers.net +Additions+
http://www.freelancers.net/advert.php
Freelancers and Freelance Jobs:
http://www.freelancers.net
Forum FAQs:
http://freelancers.netrickery.com
To unsubscribe please email:
[EMAIL REMOVED]
If you have difficulties unsubscribing please email:
[EMAIL REMOVED]
|
 |
|