Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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 ...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139