recordset paging and display resultsets in columns
Hi,
How can I do the recordset paging and display the result sets in columns horizontaly?
The codes of paging and columns display do not match together.
One uses while statement and the other uses for-next.
I need to have both of them on a page.
Is it possible at all?
set rs=server.createobject("adodb.recordset")
Rs3.open "SELECT * FROM cards where cards.catid=" & intCatID & " and cards.subID=" & intSubID & " and cards.active=1",Conn,3,3
If Request.QueryString("page") = "" Then
intPage = 1
Else
intPage = Request.QueryString("page")
End If
RS3.PageSize = 10
intPageCount = RS3.PageCount
intRecordCount = RS3.RecordCount
<%
If NOT (RS3.BOF AND RS3.EOF) Then
If CInt(intPage) > CInt(intPageCount) Then intPage = intPageCount
If CInt(intPage) <= 0 Then intPage = 1
If intRecordCount > 0 Then
RS3.AbsolutePage = intPage
intStart = RS3.AbsolutePosition
If CInt(intPage) = CInt(intPageCount) Then
intFinish = intRecordCount
Else
intFinish = intStart + (RS3.PageSize - 1)
End if
End If
If intRecordCount > 0 Then
For intRecord = 1 to RS3.PageSize
Dim link_rated
Dim link_rate_count
Dim link_rate_value
Dim NumRows,Index
NumRows = -2
index = 0
rs_NumRows = rs_NumRows + NumRows
startrw = 0
endrw = index
numberOFColumns =4
numrows = -1
while ((numrows <> 0) AND (Not rs3.EOF))
startrw = endrw + 1
endrw = endrw + numberOFColumns
num=num+1
while ((startrw <= endrw) AND (Not rs3.EOF))
%>
<TD vAlign=top align=middle class=text>
<BR>
<% if rs3("free")=True then %><IMG src="free.gif" border=0><a href="viewcard.asp?id=<%=rs3("cardid")%>"><IMG src="<%=rs3("thumbnail")%>" width="<%=rs2("thumb_width")%>" height="<%=rs2("thumb_height")%>" alt="<%=rs3("name")%>" border=0></a><IMG
class=Space_Border src="space.gif"
border=0><BR>
<%if rs3("type")="image" then%><IMG src="hs.gif" border=0><%else%><IMG src="ws.gif" border=0><%end if%><BR><a href="viewcard.asp?id=<%=rs3("cardid")%>"><%=rs3(" name")%></a><BR>Views:<%=rs3("views")%><%end if%>
<%if rs3("free")=False then %>
<IMG class=Space_Border src="space.gif" border=0><a href="viewcard.asp?id=<%=rs3("cardid")%>"><IMG src="<%=rs3("thumbnail")%>" width="<%=rs2("thumb_width")%>" height="<%=rs2("thumb_height")%>" alt="<%=rs3("name")%>" border=0></a><IMG
class=Space_Border src="space.gif"
border=0><BR>
<%if rs3("type")="image" then%><IMG src="hs.gif" border=0><%else%><IMG src="ws.gif" border=0><%end if%><BR><a href="viewcard.asp?id=<%=rs3("cardid")%>"><%=rs3(" name")%></a><BR>Views:<%=rs3("views")%>
<%
end if%>
</TD>
<%
startrw = startrw + 1
rs3.movenext
wend
%>
</tr>
<%
numrows=numrows-1
Wend
%>
<%
'rs3.movenext
If RS3.EOF Then Exit for
Next
%>
</TABLE></TD></TR>
<TR class=titlebg>
<TD width="100%" height=26> </TD></TR>
<TR class=tblBG>
<TD width="100%">
</P></TD></TR></TBODY></TABLE></CENTER></DIV><br>
<table width="759" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="124"> </td>
<td width="729"><table width="617" border="0" cellpadding="0" cellspacing="0" background="images/bottom_bg.gif" class="text">
<tr>
<td width="11"><img src="images/bottom01.gif" width="11" height="22"></td>
<td width="593" align="center" class="text">©
2005 Keyvan1.com</td>
<td width="13" align="right"><img src="images/bottom02.gif" width="13" height="22"></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<table border="0" cellpadding="0" cellspacing="0" width="75%" align=center>
<tr>
<td width="50%" align="center">
<%If cInt(intPage) > 1 Then%>
<%= "<a href='show.asp?page=" & intPage-1 & "&catid=" & intcatID & "'>" & "<img src=images/back.gif border='0'>" & "</a>" %>
<%End If%>
<%
If cInt(intPage) > 1 or NOT rs3.EOF Then
For intLinkPageNum = 1 to intPageCount
If intLinkPageNum = intPage Then
Response.Write vbcrlf & " " & intLinkPageNum
Else
Response.Write " <a & href='show.asp?page=" & intLinkPageNum & "&catid=" & intcatID & "'>" & intLinkPageNum & "</a> "
End If
Next
End If
If cInt(intPage) < cInt(intPageCount) Then
response.write "<a href='show.asp?page=" & intPage+1 & "&catid=" & intcatID & "'>" & "<img src=images/next.gif border='0'>" & "</a>"
End If
%>
</tr>
</table>
<%
end if
end if
rs.close
set rs=nothing
rs2.close
set rs2=nothing
%>
|