how can I find what value is in my variable?

M

Middletree

At first glance, the question in the subject line seems way too easy. But I
am finding some situations in my app where the value in a variable is some
sort of blank-like value, such as Null or " " or "", but I cannot tell
which.

Of course, in order to find out the value, I did a response.write, and added
a nonsense word afterward, to help make sure it is writing it out for me.

First, I tried to check for null:

if IsNull(strOrigValue) then

response.Write strOrigValue & "if"

response.End

else

response.Write trim(strOrigValue) & "else"

response.End


end if

==================

If not NULL, then perhaps it's blank, or a space. I tried this:

if Trim(strOrigValue) = "" then

response.Write strOrigValue & "if"

response.End

else

response.Write trim(strOrigValue) & "else"

response.End


end if

=====================

In both cases, I ended up with "else" being displayed. I am at a loss here.
Is there something else I can check for that will make it fall into the "if"
part of the statement?
 
D

Dave Anderson

M

Mike Brind

Middletree said:
At first glance, the question in the subject line seems way too easy. But I
am finding some situations in my app where the value in a variable is some
sort of blank-like value, such as Null or " " or "", but I cannot tell
which.

Of course, in order to find out the value, I did a response.write, and added
a nonsense word afterward, to help make sure it is writing it out for me.

First, I tried to check for null:

if IsNull(strOrigValue) then

response.Write strOrigValue & "if"

response.End

else

response.Write trim(strOrigValue) & "else"

response.End


end if

==================

If not NULL, then perhaps it's blank, or a space. I tried this:

if Trim(strOrigValue) = "" then

response.Write strOrigValue & "if"

response.End

else

response.Write trim(strOrigValue) & "else"

response.End


end if

=====================

In both cases, I ended up with "else" being displayed. I am at a loss here.
Is there something else I can check for that will make it fall into the "if"
part of the statement?

Try Response.Write TypeName(strOrigValue)

If that doesn't light a bulb somewhere, show the code that generates
the variable's value.
 
M

Mike Brind

Mike said:
Try Response.Write TypeName(strOrigValue)

If that doesn't light a bulb somewhere, show the code that generates
the variable's value.

Oh, and if the result of the above is Empty, check the spelling of the
variable name where it gets its value assigned.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top