Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Detecting empty or null value?

Reply
Thread Tools

Detecting empty or null value?

 
 
jodleren
Guest
Posts: n/a
 
      10-27-2009
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

 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      10-27-2009
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


 
Reply With Quote
 
 
 
 
rob^_^
Guest
Posts: n/a
 
      12-12-2009
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:a5d4bd44-f60b-4817-82bf-...
> 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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Begin() applied on empty Vector returns NULL or non null value???? Col C++ 1 04-21-2006 01:12 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
Can you help with detecting empty cells in a datagrid ?? Simon Prince ASP .Net 3 01-12-2005 01:40 PM
interpreting a null pointer as an empty (null string) Dennis Allison C Programming 11 03-06-2004 12:47 PM
Detecting empty in an IFrame Marcel Balcarek ASP .Net 2 12-17-2003 11:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57