Catch Nulls and blanks?

J

jason

How does one accurately catch NULL or blank fields in ASP....it appears this
If statement does not appear to be able to catch it...why is this...I appear
to have covered all the necessary conditions but it does not seem able to
pick it up:

If IsNull(Owner_ID) or Owner_ID="" or IsEmpty(Owner_ID) or Owner_ID = Null
Then

Response.Write "A null value has been picked up in the Owner_ID field"

End If
 
R

Ray at

If don't care about NULL vs. empty, you can do:

Owner_ID = YourRecordSet.Fields.item("whatever").Value & ""
If Owner_ID = "" Then Response.Write "The value is null or empty."

Ray at work
 
R

Randy Rahbar

How does one accurately catch NULL or blank fields in ASP....it appears
this

I usually test for length...

if len(yourVariable) > 0 then
'it's not null or blank
else
'it is
end if
 
R

Randy Rahbar

if len(yourVariable) > 0 then

This should probably be...
if len(trim(yourVariable)) > 0 then
 
J

jason

Thanks.


Ray at said:
If don't care about NULL vs. empty, you can do:

Owner_ID = YourRecordSet.Fields.item("whatever").Value & ""
If Owner_ID = "" Then Response.Write "The value is null or empty."

Ray at work
 
V

Venkat

You can user one more property provided in VB and VB Script i.e.,
vbNullString and then try.

If IsNull(ColumnName) Or ColumnName <> "" Or ColumnName <> vbNullString
Then
Do Something
End If

DEVBuilder.org, http://www.DEVBuilder.org
ASP,ASP.NET,VB.NET,PHP,Java,and SQL Support, all in one place.
 
S

Steven Burn

If Len(Owner_ID) = 0 Then
'Do something
Else
'Do something else
End If

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

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,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top