Link to home
Start Free TrialLog in
Avatar of lshane
lshane

asked on

Classic ASP: Display item until End Of File

Hello.  I am working with Classic ASP (Not .NET) with an MS Access database.

I just need to know the syntax of how to only show something while not at End Of File.

Example:  I only want to show the " | " symbol after each dynamic list link EXCEPT after the last one.

I thought it was something like:
<%IF NOT rsRecordset.Field ("Field name").EOF then%>
Show the symbol
<%END IF%>

Does this look right?

Thanks so much,
Shane
Avatar of WMIF
WMIF

its actually from the recordset itself.  

rsRecordset.eof
Avatar of lshane

ASKER

So, would it be as simple as:

<%IF NOT rsRecordset.EOF then%>
Show symbol
<%END IF%>

...OR, would I need to add quotes or parentheses or something else in the syntax?

eof will only be true once you have moved past the last record.

print - rec 1
rs.movenext
print - rec 2
rs.movenext
print - rec 3
eof = false
rs.movenext
eof = true
that should work just as you have it.
Avatar of lshane

ASKER

OK - thank you for your help.  I need a little more, though.  I am using DW MX, becaue I'm not proficient enough not to use it.

Here is the link for the site:  <http://www.clutter2treasure.net/antiques_list.asp>
You will see the list of links in the center with the " | " after the last link.  I would like for that NOT to appear after the last link.

So, here is the segment of code for that loop:

------------------------------------------------------------------------------------------------------
While ((Repeat1__numRows <> 0) AND (NOT rsAntiqueList.EOF))
%>
                      <a href="antiques_results.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "subcatID=" & rsAntiqueList.Fields.Item("subcatID").Value %>"><%=(rsAntiqueList.Fields.Item("subcatName").Value)%></a>&nbsp;|&nbsp;
                      <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsAntiqueList.MoveNext()

Wend
%>
------------------------------------------------------------------------------------------------------

What should I do?

Thanks so much,
Shane
You may be able to do this without ASP.  You can use the pseudo-selectors :first-child and :before to denote that you want the pipe missing on the first link and printed on the rest.

a:first-child{
/*normal stylings*/
}
a:before{
content:"|"
}

I'll double check the code later, but that might get you started.

ASKER CERTIFIED SOLUTION
Avatar of WMIF
WMIF

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 lshane

ASKER

Thank you, WMIF!  That was perfect!


Thanks so much,
Shane
glad to help.