Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 loop problem maybe?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

asp_storm
Average Member

USA
787 Posts

Posted - 07 April 2002 :  18:47:47  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
i am using this code:

<html>
<body>
<%

Dim Trick
Dim ID
Dim Skier
Dim Url
Dim Photog
Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "d:\guess"

Set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT Trick,Url,ID FROM images"
rs.Open sql,conn
%>
<table border="1" width="100%">
<tr>

<%Do Until rs.EOF%>

<%For Each x In rs.Fields%>
<tr><td><a href="/images.asp?ID=<%=rs("ID")%>"><%=rs("Trick")%></a></td>
<%Next
rs.MoveNext%></tr>

<%
Loop
rs.close
conn.close
%> </tr>
</table>

</body>
</html>
its basically a loop to through a db table and show the description of a pic and a link to it. but my prob is that it shows the descrption 3 times..ie:
trick
trick
trick
trick1
trick1
trick1
and so on..so any ideas?



Nikkol
Forum Moderator

USA
6907 Posts

Posted - 07 April 2002 :  19:13:03  Show Profile
The problem is with this part:
quote:

<%For Each x In rs.Fields%>
<tr><td><a href="/images.asp?ID=<%=rs("ID")%>"><%=rs("Trick")%></a></td>
<%Next



Take out the for and the next lines.

Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 07 April 2002 :  21:25:37  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
ok..i did that and now it takes a LONG time to load...any ideas again?
;)



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 07 April 2002 :  21:35:24  Show Profile
Make sure the code looks like this:

<table border="1" width="100%">
<%Do Until rs.EOF%>
<tr><td><a href="/images.asp?ID=<%=rs("ID")%>"><%=rs("Trick")%></a></td></tr>
<%rs.MoveNext
Loop
rs.close
conn.close%>
</table>


Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 07 April 2002 :  21:43:37  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
quote:

Make sure the code looks like this:

<table border="1" width="100%">
<%Do Until rs.EOF%>
<tr><td><a href="/images.asp?ID=<%=rs("ID")%>"><%=rs("Trick")%></a></td></tr>
<%rs.MoveNext
Loop
rs.close
conn.close%>
</table>


Nikkol


that worked..thanks again Nikkol..



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 07 April 2002 :  22:13:29  Show Profile
Yeppers

Nikkol
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07