Recordset problems

Discussion in 'ASP General' started by polilop, May 4, 2005.

  1. polilop

    polilop Guest

    I have a recordset which i have to check if it is empty and if its not then
    to print it out
    something like

    <% if Not(emptyStr=rsBoats.Fields.Item("Price_descr").Value) Then%>
    <TR> <TD colSpan=4><div align="center"></div>
    <div align="left"><span class="titl"><span class="maliNaslovi">Price
    description</span></span> </div></TD>
    </TR>
    <TR><TD><div align="left"></div></TD>
    <TD colSpan=2><div
    align="left"><%=(rsBoats.Fields.Item("Price_descr").Value)%></div></TD>
    <TD>&nbsp;</TD>
    </TR>
    <% End if%>

    But the second one never prints out why?
    polilop, May 4, 2005
    #1
    1. Advertising

  2. polilop wrote:
    > I have a recordset which i have to check if it is empty


    Be more specific. Do you want to know if the recordset is empty (no
    records)? Or do you want to test if a specific field contains data (as
    appears to be the case from your attempt below)?

    > and if its
    > not then to print it out
    > something like
    >
    > <% if Not(emptyStr=rsBoats.Fields.Item("Price_descr").Value) Then%>


    > <TR> <TD colSpan=4><div align="center"></div>
    > <div align="left"><span class="titl"><span
    > class="maliNaslovi">Price description</span></span> </div>

    </TD>

    ?? Why do you have all the empty/nested divs and spans?

    > </TR>
    > <TR><TD><div align="left"></div></TD>
    > <TD colSpan=2><div
    > align="left"><%=(rsBoats.Fields.Item("Price_descr").Value)%></div></TD>
    > <TD>&nbsp;</TD>
    > </TR>
    > <% End if%>
    >
    > But the second one never prints out why?


    Huh? What second one?

    I think you want to test if the field contains data, correct? Try this (I've
    reformatted the html to make it a little more readable, as well as removing
    the emptiy divs.):

    <%
    dim price
    price = rsBoats("Price_descr").value
    if len(price) = 0 then
    price= 0
    end if
    %>
    <TR>
    <TD colSpan=4>
    <div align="left">
    <span class="titl">
    <span class="maliNaslovi">
    Price description
    </span>
    </span>
    </div>
    </TD>
    </TR>
    <TR>
    <TD>
    <div align="left"></div>
    </TD>
    <TD colSpan=2>
    <div align="left">
    <%=price%>
    </div>
    </TD>
    <TD>&nbsp;</TD>
    </TR>


    Bob Barrows


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], May 4, 2005
    #2
    1. Advertising

  3. polilop

    polilop Guest

    Solved it OK!

    "polilop" <> wrote in message
    news:d5afgi$eu0$...
    >I have a recordset which i have to check if it is empty and if its not then
    >to print it out
    > something like
    >
    > <% if Not(emptyStr=rsBoats.Fields.Item("Price_descr").Value) Then%>
    > <TR> <TD colSpan=4><div align="center"></div>
    > <div align="left"><span class="titl"><span class="maliNaslovi">Price
    > description</span></span> </div></TD>
    > </TR>
    > <TR><TD><div align="left"></div></TD>
    > <TD colSpan=2><div
    > align="left"><%=(rsBoats.Fields.Item("Price_descr").Value)%></div></TD>
    > <TD>&nbsp;</TD>
    > </TR>
    > <% End if%>
    >
    > But the second one never prints out why?
    >
    polilop, May 4, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vikas Yadav
    Replies:
    0
    Views:
    1,117
    Vikas Yadav
    Sep 9, 2003
  2. gary artim

    recordset error/perl messages

    gary artim, Feb 6, 2004, in forum: Perl
    Replies:
    0
    Views:
    488
    gary artim
    Feb 6, 2004
  3. egsdar

    Problems to use my recordset

    egsdar, Nov 15, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    712
    egsdar
    Nov 16, 2008
  4. Hung Huynh
    Replies:
    8
    Views:
    290
    Bob Barrows
    Sep 24, 2003
  5. CrazyAtlantaGuy
    Replies:
    2
    Views:
    131
    CrazyAtlantaGuy
    Nov 30, 2005
Loading...

Share This Page