basic question

Results 1 to 2 of 2

Thread: basic question

  1. #1
    Join Date
    Dec 1969

    Default basic question

    Sorry it is a very basic thing that I am asking, but I am stuck.<BR>I am checking a value "answer" in the data base, it is a numeric value.<BR>If the value is empty then assign nil to x and print otherwise assign <BR>the value to x and print. It is not working when answer field has no <BR>value.<BR>The code is as follows<BR><BR><BR>if rs2("answer")= " " then<BR> x = "nil"<BR> else <BR>x = rs2("answer") <BR>end if<BR>response.write (x)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: basic question

    if len(rs2("answer"))= 0 then <BR>x = "nil"<BR>else <BR>x = rs2("answer") <BR>end if<BR>response.write (x)<BR><BR>You tried to set x= "nil" *IF* rs2("answer") was a single space. To test if an variable contains anything I always use:<BR> IF Len(var) = 0 then ...<BR><BR>IMHO this is the best way to test this.<BR><BR>Peter<BR>

Posting Permissions

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