JuniorBee
asked on
Paging records with multiple column table display help
Hi,
I have the code below which I edited to try to make a long story short. :) The paging works fine when I make it one line per record, but when I try to change the value of the lines:
.PageSize = 2
if counter >= 3 then
it does not do what I think it will do. If I put
.PageSize = 2
if counter >= 3 then
then it should only display only 2 records although it says there will be 3 records per row.
if I put
.PageSize = 24
if counter >= 2 then
Then I should have 24 records showing in rows of 2 on each page.
However, I cannot see what is wrong with the math here I guess. It's so very confusing to me. If anyone cares to take a look I would appreciate it greatly!
<%
dim thisPage, rowcount, i
thisPage = Trim(Request("thisPage"))
if thisPage = "" then thisPage = 1
Set conn = Server.CreateObject("ADODB .Connectio n")
conn.Open xDb_Conn_Str
strsqlCFG1 = "SELECT * FROM TABLE"
Set rstempCFG1 = conn.execute(strsqlCFG1)
if (rstempCFG1.eof) = true then
Response.write "Nothing to show you."
Else
Set rstempCFG1 = nothing
set rstempCFG1 = Server.CreateObject("ADODB .Recordset ")
with rstempCFG1
.CursorType = adOpenStatic
.PageSize = 3
.Open "SELECT * FROM TABLE", conn
.AbsolutePage = cINT(thisPage)
end with
rowCount = 0
while not rstempCFG1.EOF and rowCount < (rstempCFG1.PageSize)
%>
<table>
<tr>
<%
do until rstempCFG1.eof
%>
<td>Data will show here: <%=rstempCFG1("field")
</td>
<%
if counter >= 3 then
counter = 0
end if
counter = counter + 1
rstempCFG1.movenext
%> <%
rowCount = rowCount + 1
loop
if rstempCFG1.eof then
response.write "</tr>"
else
rstempCFG1.MoveNext
end if
%> </td>
</tr>
</table>
<%
wend
Response.Write "<br clear=all>Next Page >"
for i = 1 to rstempCFG1.PageCount
%> <a href="page.asp?thisPage=<% =i%>"><%=i %></a> <% next %> <%
end if
end if
set rstempCFG1 = nothing
%>
I have the code below which I edited to try to make a long story short. :) The paging works fine when I make it one line per record, but when I try to change the value of the lines:
.PageSize = 2
if counter >= 3 then
it does not do what I think it will do. If I put
.PageSize = 2
if counter >= 3 then
then it should only display only 2 records although it says there will be 3 records per row.
if I put
.PageSize = 24
if counter >= 2 then
Then I should have 24 records showing in rows of 2 on each page.
However, I cannot see what is wrong with the math here I guess. It's so very confusing to me. If anyone cares to take a look I would appreciate it greatly!
<%
dim thisPage, rowcount, i
thisPage = Trim(Request("thisPage"))
if thisPage = "" then thisPage = 1
Set conn = Server.CreateObject("ADODB
conn.Open xDb_Conn_Str
strsqlCFG1 = "SELECT * FROM TABLE"
Set rstempCFG1 = conn.execute(strsqlCFG1)
if (rstempCFG1.eof) = true then
Response.write "Nothing to show you."
Else
Set rstempCFG1 = nothing
set rstempCFG1 = Server.CreateObject("ADODB
with rstempCFG1
.CursorType = adOpenStatic
.PageSize = 3
.Open "SELECT * FROM TABLE", conn
.AbsolutePage = cINT(thisPage)
end with
rowCount = 0
while not rstempCFG1.EOF and rowCount < (rstempCFG1.PageSize)
%>
<table>
<tr>
<%
do until rstempCFG1.eof
%>
<td>Data will show here: <%=rstempCFG1("field")
</td>
<%
if counter >= 3 then
counter = 0
end if
counter = counter + 1
rstempCFG1.movenext
%> <%
rowCount = rowCount + 1
loop
if rstempCFG1.eof then
response.write "</tr>"
else
rstempCFG1.MoveNext
end if
%> </td>
</tr>
</table>
<%
wend
Response.Write "<br clear=all>Next Page >"
for i = 1 to rstempCFG1.PageCount
%> <a href="page.asp?thisPage=<%
end if
end if
set rstempCFG1 = nothing
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.