Ask a Question related to ASP Database, Design and Development.
-
Andy #1
paging recordsets
can anyone tell me whats wrong with this it puts out the first page of the
records but i can't get it to cycle through them upon pressing next
if request.ServerVariables("CONTENT_LENGTH")=0 then
cpage=1
else
cpage=cint(request.Form("cpage"))
' response.write cpage
select case request.Form("Submit")
case "Previous"
cpage=cpage-1
case "Next"
cpage=cpage+1
response.Write cpage
end select
end if
set objrs=server.CreateObject("ADODB.Recordset")
objrs.CursorLocation=aduseClient
objrs.CursorType=adOpenStatic
objrs.cacheSize=intpagesize
strQ="select * from book where allow=yes order by id desc"
objrs.open strQ,conn,,,adCmdText
objrs.pagesize=intpagesize
if not(objrs.eof) then objrs.AbsolutePage=cpage
totalpages=objrs.pagecount
for intI=1 to objrs.pagesize
<<<-----------snipped response.write output table contents
objrs.movenext
if objrs.eof then exit for
next
objrs.close
response.write "<br>" &vbcrlf&"page:" &cpage &" of " & totalpages &"<p>"
%>
<form action="<%= request.ServerVariables("SCRIPT_NAME") %>"method="post">
<input type="hidden" name="currentpage" value="<%= cpage %>">
<%
if cpage >1 then
%>
<input type="Submit" name="Submit" value="Previous">
<%
end if
if cpage <>totalpages then
%>
<input type="Submit" name="Submit" value="Next">
<%
end if
Andy Guest
-
adding recordsets
i have set up an access database, linked it in through dw8 but when i go to bindings - recordset i get the following error "at line 29 of the file ... -
ASP Recordsets
Hi there, i'm developing an ASP SQL application, and was just wondering whether for some reason this limited me to one recordset per page. the... -
Multiple recordsets?
Hey all I'm not sure if there's anything that can be done about this or not. I'm displaying the contents of two different tables (using Access for... -
Persisted XML Recordsets - Disconnected Recordsets - problems
I have a recordset, client side .ASP that I save as a DOM. I pass to a server side .ASP to reconnect the recordset and update. I keep getting an... -
Paging recordsets.
Hi All win 2k sp4 sql 2k sp3 asp vbscript iis5 I was looking at the ASPfaq(id 2120) the other week and it said that paging recordsets for... -
Troy Stark #2
Re: paging recordsets
The hidden variable name you pass is not cpage, its currentpage
either:
cpage= cint(request.form("currentpage"))
or
change the name in the hidden field to cpage.
"Andy" <andy@jarrow_online.com> wrote in message
news:bjb4lq$tu6$1@news6.svr.pol.co.uk...> can anyone tell me whats wrong with this it puts out the first page of the
> records but i can't get it to cycle through them upon pressing next
>
>
> if request.ServerVariables("CONTENT_LENGTH")=0 then
> cpage=1
> else
> cpage=cint(request.Form("cpage"))
> ' response.write cpage
>
> select case request.Form("Submit")
> case "Previous"
> cpage=cpage-1
> case "Next"
> cpage=cpage+1
> response.Write cpage
> end select
> end if
>
> set objrs=server.CreateObject("ADODB.Recordset")
>
> objrs.CursorLocation=aduseClient
> objrs.CursorType=adOpenStatic
> objrs.cacheSize=intpagesize
> strQ="select * from book where allow=yes order by id desc"
> objrs.open strQ,conn,,,adCmdText
>
> objrs.pagesize=intpagesize
>
> if not(objrs.eof) then objrs.AbsolutePage=cpage
> totalpages=objrs.pagecount
> for intI=1 to objrs.pagesize
>
> <<<-----------snipped response.write output table contents
>
> objrs.movenext
> if objrs.eof then exit for
> next
> objrs.close
> response.write "<br>" &vbcrlf&"page:" &cpage &" of " & totalpages &"<p>"
>
> %>
> <form action="<%= request.ServerVariables("SCRIPT_NAME") %>"method="post">
> <input type="hidden" name="currentpage" value="<%= cpage %>">
> <%
> if cpage >1 then
> %>
> <input type="Submit" name="Submit" value="Previous">
> <%
> end if
> if cpage <>totalpages then
> %>
> <input type="Submit" name="Submit" value="Next">
> <%
> end if
>
>
Troy Stark Guest



Reply With Quote

