---
title: "NextPage"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/7809-nextpage"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "costodia"
published: "2001-01-21T20:37:00.000Z"
updated: "2001-01-21T22:36:00.000Z"
replies: 3
views: 164
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/7809-nextpage"
---

# NextPage

## #1 — costodia, 2001-01-21T20:37Z

Jag skulle kunna vilja trycka nextpage på min sida <http://www.costodia.com/kompis/index.asp?whichpage=11&pagesize=10>  

hur skulle en sådan kod kunna se ut?

jag använder denna kod:

```
<table>
<%
mypage = Request("whichpage")
If mypage = "" then
   mypage = 1
End If
mypagesize = 10

SQL = "Select * From tabell Order by fält"

Set rstemp = Server.Createobject("ADODB.Recordset")
rstemp.cursorlocation = 3
rstemp.cachesize = 5
MdbFilePath = Server.MapPath("path/databas.mdb")
rstemp.open SQL, "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
If rstemp.EOF then
   Response.write "Där fanns det ju inget... " & sok
Else
   rstemp.movefirst
   rstemp.pagesize = mypagesize
   maxcount = Cint(rstemp.pagecount)
   rstemp.absolutepage = mypage
   howmanyrecs = 0
   howmanyfields = rstemp.fields.count -1
   Do While Not RStemp.EOF AND howmanyrecs < rstemp.pagesize
   counter = counter + 1
   If counter mod 2 = 0 then
      color = "CCCC99"
   Else
      color = "CCCC66"
   End If
   Response.write "<tr bgcolor='" & color & "'><td>" & RStemp("fält") & "</td></tr>"

   rstemp.movenext
   howmanyrecs = howmanyrecs + 1
   Loop
   rstemp.close
   Set rstemp = nothing
   %>
   <tr><td><hr></td></tr>
   <tr><td>
   <%
   If maxcount <> 0 then
   response.write "sida " & mypage & " av " & maxcount & "<br>" & sidor:
   pad = "0"
   scriptname = request.Servervariables("script_name")
   for counter = 1 to maxcount
   If counter >= 10 then
      pad = ""
   End If
   ref = "<a href='" & scriptname & "?whichpage=" & counter & "&pagesize=" & mypagesize & "'>" & pad & counter & "</a> "
   response.write ref & " "
   if counter mod 10 = 0 then
      response.write "<br>"
   End If
   Next
   End If
End If
%>
</td></tr>
</table>
```

Permalänk: https://www.webforum.nu/p/7809

## #2 — Rossifumi, 2001-01-21T20:44Z

Ta bara och gör en länk:

```

<a href="index.asp?wichpage=<% = mypage + 1 %>&pagesize=10">Next page</a>
```

Eller missförstod jag dig?

Permalänk: https://www.webforum.nu/p/254148

## #3 — costodia, 2001-01-21T22:06Z

nej, du förstod mig nog rätt,
men tyvärr verkar inte länken vilja gå till nästa sida utan stannar på sida ett på <http://www.costodia.com/kompis/index.asp?wichpage=1&pagesize=10>  kan det vara något mellanrum eller något som gör att det inte funkar?

Permalänk: https://www.webforum.nu/p/254149

## #4 — Rossifumi, 2001-01-21T22:36Z

Hmm, det var inte bara det att du la in den koden innan du satte "mypage"?

Vad händer annars ifall du skriver

```
<a href="index.asp?whichpage=<% = Request.QueryString("whichpage") + 1 %>&pagesize=10">Next page</a>
```

Denna kod har en bugg... du måste kolla ifall du är på sista sidan också... Borde bara gå att jämföra med pagecount ifall du är där (på sista sidan alltså) :)

Permalänk: https://www.webforum.nu/p/254150

---

Tråden på webben: https://www.webforum.nu/amne/asp/7809-nextpage
