Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Avoiding fields that are empty 1

Status
Not open for further replies.

timcadieux

Programmer
May 25, 2005
129
BE
I've noticed that certain fields in my DB are empty, i want to avoid referring to them if they actually contain no text.

In this case, neither

Code:
rs(article)>1

or

ISNULL(rs(article))

Will work, other than changing the way the info is input into the db, how can i avoid this with existing information?
 
i mean other way round :

Code:
if rs("article")<>"" then

or 

if len(rs("article")>0 then

-DNG
 
I tried both of those before posting, when i did a response.write Len(article), it gave me 36 but when i looked in the DB, the field was empty?
 
how about this:

if trim(rs("article"))<>"" then

or

if trim(len(rs("article"))>0 then

-DNG
 
i think the problem is that some of your data was deleted manually and spaces are still left out...and thats the reason you were getting a count of 36 and still you see the database field as empty...

you can also do...

if rs("article")<>"" OR ISNULL(rs("article")) then

-DNG
 
isn't trhat contradictory, shouldn't it be
if rs("article")<>"" OR NOT ISNULL(rs("article")) ??
 
i meant to say:

if rs("article")="" OR ISNULL(rs("article")) then

thanks for the correction, though...trim() function should work fine for you...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top