Detecting empty or null value?

Discussion in 'ASP General' started by jodleren, Oct 27, 2009.

  1. jodleren

    jodleren Guest

    Hello all

    I tryid to find anything here, but not exactly what I need. My
    solution as of now is:

    sMine=rsjob.fields(0).value
    if sMine & ""="" then sMine="undefined"

    Just how should it be properly done?

    if smine="" or smine=NULL then ?
    The =null does not work :)

    What is the right thing then?

    WBR
    Sonnich
     
    jodleren, Oct 27, 2009
    #1
    1. Advertising

  2. jodleren

    Bob Barrows Guest

    jodleren wrote:
    > Hello all
    >
    > I tryid to find anything here, but not exactly what I need. My
    > solution as of now is:
    >
    > sMine=rsjob.fields(0).value
    > if sMine & ""="" then sMine="undefined"


    Nothing is wrong with that. Is it giving you the wrong answer?
    >
    > Just how should it be properly done?
    >
    > if smine="" or smine=NULL then ?
    > The =null does not work :)
    >

    vbscript has two ways of testing for null:

    if sMine Is Null then

    or

    if IsNull(sMine) then

    Either works.

    --
    HTH,
    Bob Barrows
     
    Bob Barrows, Oct 27, 2009
    #2
    1. Advertising

  3. jodleren

    rob^_^ Guest

    Hi,

    Just append a zero length string to convert nulls to zero length strings.
    sMine=rsjob.fields(0).value & ""

    for string fields. For numeric fields, make sure they do not allow nulls and
    that the default binding value is valid.

    This also works for asp query parameters and makes coding in asp.net easier.

    sValue = request("sValue") & ""

    I/O

    if not request("sValue") is nothing then
    .....etc.

    Regards.

    "jodleren" <> wrote in message
    news:...
    > Hello all
    >
    > I tryid to find anything here, but not exactly what I need. My
    > solution as of now is:
    >
    > sMine=rsjob.fields(0).value
    > if sMine & ""="" then sMine="undefined"
    >
    > Just how should it be properly done?
    >
    > if smine="" or smine=NULL then ?
    > The =null does not work :)
    >
    > What is the right thing then?
    >
    > WBR
    > Sonnich
    >
     
    rob^_^, Dec 12, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jm
    Replies:
    2
    Views:
    3,706
    Curt_C [MVP]
    Feb 19, 2004
  2. Replies:
    5
    Views:
    27,582
    Mike Schilling
    Mar 29, 2006
  3. Dennis Allison

    interpreting a null pointer as an empty (null string)

    Dennis Allison, Mar 5, 2004, in forum: C Programming
    Replies:
    11
    Views:
    831
    Derk Gwen
    Mar 6, 2004
  4. Col
    Replies:
    1
    Views:
    649
    peter koch
    Apr 21, 2006
  5. bob
    Replies:
    3
    Views:
    573
    Armin Zingler
    May 5, 2008
Loading...

Share This Page