IsNull or = "" not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Meditrina
    New Member
    • Sep 2010
    • 4

    IsNull or = "" not working

    I have a database that contains 3 plaque inscriptions in fields plaque, plaque2 and plaque3. I am trying to get my asp page to display only the plaques if there is data in the field. Some of the fields are null and some are just empty (no null value).

    I have the following code, but I can't get it to work consistently:

    Code:
    <div class="personalizedPlaques" style="width: 185px">
                          <p><%=rs("stock")%>Personalized <br />Engraved Plaque Ideas</p>
                          
                          <ul>
                         <% if (NOT ISNULL (rs("plaque")) And (rs("plaque"))="") then %>
                             <li class="goldPlate"><span><%=rs("Plaque")%></span>
                             </li>                     
    					  <% end if %>						
    					  <% if (NOT ISNULL (rs("plaque2")) And (rs("plaque2"))="") then %>
                            <li class="goldPlate"><span><%=rs("Plaque2")%></span>
                            </li>
                          <% end if %>
                           <% if (NOT ISNULL (rs("plaque3")) And (rs("plaque3"))="") then %>
                      		<li class="goldPlate"><span><%=rs("Plaque3")%></span>
                            </li>
                          <% end if %>
                          </ul>
    This works if plaque3 is NULL but if I remove the NULL from the field, then nothing shows up. I've tried changing the And to OR and using IsEmpty insted of ="", but it only works when the fields are NULL.
  • Meditrina
    New Member
    • Sep 2010
    • 4

    #2
    I fixed it. I could never figure out how to get a layered if statement to work, so ended up using LEN. This took care of it - works for Nulls or for blanks.

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      I was going to suggest len, glad you figured it out on your own.

      Jared

      Comment

      Working...