Link to home
Start Free TrialLog in
Avatar of confused_coder
confused_coder

asked on

sql vbscript if record null then

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
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TSmooth
TSmooth

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 %>
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 ~