?
Solved

sql vbscript     if record null then

Posted on 2007-07-19
3
Medium Priority
?
3,312 Views
Last Modified: 2008-01-09
I want to skip over a record if it is null so it does not print the section of the data

currently I have this which does not work

<% IF (NOT ISNULL (rs("OrgPhoneTTY"))) THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>

but it still prints the TTY if its empty
0
Comment
Question by:confused_coder
3 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 2000 total points
ID: 19525062
Most likely it is not NULL but empty string. Try it this way ...

<% IF (NOT ISNULL (rs("OrgPhoneTTY"))) THEN %>
<% IF (TRIM(rs("OrgPhoneTTY")) <> "") THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>
<% end if %>
0
 
LVL 16

Expert Comment

by:TSmooth
ID: 19525069
Empty is different than null. Are you sure that rs("OrgPhoneTTY") is returning null and not just an empty string? What you can probably do is change it to this:

<% IF (NOT rs("OrgPhoneTTY") <> "" ) THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>
0
 
LVL 3

Expert Comment

by:mastallama
ID: 19525199
Both previous expert comments could be correct.  if you go with amit's then you should do it all in 1 IF statement:

<% If Not isNull(rs("OrgPhoneTTY")) OR rs("OrgPhoneTTY")<>"" Then %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% End If %>

~ MastaLlama ~
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question