Detecting empty or null value?

J

jodleren

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
 
B

Bob Barrows

jodleren said:
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.
 
R

rob^_^

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.
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top