Results 1 to 5 of 5

Thread: recognizing null

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Boulder
    Posts
    32

    Talking recognizing null

    I am trying to find a better way to recognize a null value than the one I am currently using:

    For Each Feel In objInfo.Fields
    *** If TypeName(Feel.Value) = "Null" Then
    Response.write "<TD> &nbsp </TD>"
    Else
    Response.Write "<TD>" & Feel.Value & "</TD>"
    End If
    Next

    This works...but I would rather use something more like VB...
    If IsNull...I know that VBScript does not support this, but what are the alternatives? Thanks.

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    IsEmpty() does the same thing to my knowledge.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    Lively Member
    Join Date
    May 2001
    Posts
    127
    IsNull is part of VBscript and works under ASP pages both 2.0 and 3.0

    I would use that

    if it doesn't work your value is not really null

    Most of the time ASP just does 0 length string

    ""

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Or you can just do this:

    For Each Feel In objInfo.Fields
    strValue = Str(Feel.Value) & " "
    Response.Write "<TD>" & strValue & "</TD>"
    Next

    Since HTML ignores whitespace, it will display the " " or the value.

    Sastraxi: Empty is different from NULL..
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    How about:

    If Len(something) = 0 Then ...

    IIRC, that should work for Null or Empty Strings.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width