473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Catch Nulls and blanks?

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
Jul 19 '05 #1
7 2770
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

"jason" <ja***@catamaranco.com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
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

Jul 19 '05 #2
> 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
Jul 19 '05 #3
> if len(yourVariable) > 0 then

This should probably be...
if len(trim(yourVariable)) > 0 then
Jul 19 '05 #4
Thanks.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eb**************@tk2msftngp13.phx.gbl...
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

"jason" <ja***@catamaranco.com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
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


Jul 19 '05 #5
Thanks.

"Randy Rahbar" <rvrahbar@_JUNK_hotmail.com> wrote in message
news:uC*************@tk2msftngp13.phx.gbl...
if len(yourVariable) > 0 then


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

Jul 19 '05 #6
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.
Jul 19 '05 #7
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)
jason <ja***@catamaranco.com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
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

Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function,...
1
by: PST | last post by:
Here's a problem I'm trying to deal with: I'm working on a Frontpage 2000 website for a boat handicapping system, built in Access 97. What I'm trying to accomplish is: The user enters a...
8
by: Chris | last post by:
I know the reason why I get an error when the fields are set to null, but I'm working with old data that contains them. Any quick fixes? was hoping to avoid writing out every field in sql statement...
9
by: Jacob | last post by:
Is there any way (maybe using an attribute) that I can force strings or other reference parameters to always have an instance even if they are blank? Ex: public string DoSomething(string Text)...
34
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
17
by: =?Utf-8?B?VGVycmFuY2U=?= | last post by:
Hello, I was wondering if someone can give me a few pointers in catching an exception correctly or at least making the code a little more elegant than what I have. I have a rss reader that I built...
2
by: jschmidt | last post by:
Hello Everyone, I have a View that is returning null values. This is not a problem except that I don't want the user to see "NULL" in the data. I want to replace "NULL" with a blank. The sql that I...
1
by: mzladyd | last post by:
I am loading data to an Oracle table with Informatica. There are six fields set to number format. The data includes nulls that shows in the table as zeros. How do I make the zeros show as blanks in...
4
by: eBob.com | last post by:
I have a RichTextBox in which I'd like blanks to appear different from nothing. Imagine a file which does not fill up the RTB. You can't tell how many, if any, blanks might follow the last...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.