---
title: "paging"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/14277-paging"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "hacktheplanet"
published: "2002-02-07T20:21:00.000Z"
updated: "2002-02-08T09:14:00.000Z"
replies: 5
views: 168
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/14277-paging"
---

# paging

## #1 — hacktheplanet, 2002-02-07T20:21Z

hur fixar jag det hära??

```
<%
mypage = Request("sida")
If mypage = "" then
   mypage = 1
End If
mypagesize = 36

Set db = Server.CreateObject("ADODB.Connection")
db.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("Database/grupper.mdb") 
SQL = "SELECT * FROM inlagg WHERE Rum LIKE '"& request.querystring("rum") &"' ORDER BY Datum DESC"

Set rs = db.Execute(SQL)

SQL = "SELECT * FROM rum_rum WHERE Namn LIKE '"& request.querystring("rum") &"'"
Set rs2 = db.Execute(SQL)

SQL = "SELECT * FROM medlemmar WHERE Namn LIKE '"& session("username") &"' AND Rum LIKE '"&request.querystring("rum")&"'"
Set rs3 = db.Execute(SQL) 

rs.cursorlocation = 3
rs.cachesize = 5

%>
```

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

## #2 — hacktheplanet, 2002-02-07T23:12Z

nån x(

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

## #3 — Vide, 2002-02-07T23:55Z

Utgå ifrån denna artikeln helt enkelt:
 <http://www.webeye.nu/default2.asp?que=asp/default.asp&exec=asp/artiklar/asp_17.asp>

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

## #4 — hacktheplanet, 2002-02-08T09:00Z

jag vill helst använda mig utav:

```
                <%
   If maxcount <> 0 then
   pad = "0"
   scriptname = request.Servervariables("script_name")
   for counter = 1 to maxcount
   If counter >= 10 then
      pad = ""
   End If
ref = "<a href='" & scriptname & "?sida=" & counter & "&pagesize=" & mypagesize & "&tillid=" & Request.QueryString("tillid") & "'>" & pad & counter & "</a> "
   response.write ref & " "
   Next
   End If
%>
```

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

## #5 — Vide, 2002-02-08T09:04Z

Gör det då!?

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

## #6 — hacktheplanet, 2002-02-08T09:14Z

det blir mycket kod men snälla kan nån hjälpa mig :(

```
<%
on error resume next
mypage = Request("sida")
If mypage = "" then
   mypage = 1
   
End If
mypagesize = 31

Set db = Server.CreateObject("ADODB.Connection")
db.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath ("Database/grupper.mdb") 
SQL = "SELECT * FROM inlagg WHERE Rum LIKE '"& request.querystring("rum") &"' ORDER BY Datum DESC"

Set rs = db.Execute(SQL)

SQL = "SELECT * FROM rum_rum WHERE Namn LIKE '"& request.querystring("rum") &"'"
Set rs2 = db.Execute(SQL)

SQL = "SELECT * FROM medlemmar WHERE Namn LIKE '"& session("username") &"' AND Rum LIKE '"&request.querystring("rum")&"'"
Set rs3 = db.Execute(SQL) 

%>

<html>

<head>
</head>

<body>

      <TABLE cellSpacing=0 cellPadding=0 width=313 border=0 height="35">
        <TR>
          <TD width=415 bgColor=#ffffff height="35">
             <TABLE cellSpacing=0 cellPadding=0 width=415 border=0 height="17">
              <TBODY>
              <TR>
                <TD height="17" valign="top" align="right">
                <TABLE cellSpacing=0 cellPadding=0 width=414 border=0 style="border-collapse: collapse" height="1">
              <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="1" height="1"><TBODY>
              <% IF NOT (RS.EOF) THEN %>
              <tr>
                <TD height=1 width="4"></TD>
                
                <TD align="right" height="1">
                
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="410" height="1">
                  
                  <tr>
                  
                <TD height=1 width="4"></TD>
                 
                 <TD align="right" height="1">
               
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="410" height="1">
           
                  <tr>
                 
                    <td width="410" height="1" colspan="3"></td>
                  </tr>
 
                  <tr>
              
                    <td width="18" height="1">
                    <p align="center">
                    </td>
                    <td width="196" height="1">
                     <b><font face="Arial" size="2"><%=request.querystring("rum")%></font></b></td>
                    <td width="196" height="1" valign="bottom">
                     <p align="right"><font size="1" face="Arial">
                     <a href="krypin.asp?checkid=<%=request.querystring("id")%>"><%=request.querystring("moderator")%></a>&nbsp;<%=left(request.querystring("kon"),1)%>&nbsp; </font></td>
                  </tr>

                  </table>
                                 
                </TD> 
                  </tr>

                  </table>
                                 
                </TD> 
              </tr>
              <tr>
                <TD height=1 width="4"></TD>
                <TD align="right" height="1">
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="410" height="1">
                  <tr>
                    <td width="410" height="1"></td>
                  </tr>
 
                  </table>
                               
                </TD>  
              </tr>
              </TBODY></TABLE>

                </TD>
                </TR></TBODY></TABLE>
             <TABLE cellSpacing=0 cellPadding=0 width=414 border=0 style="border-collapse: collapse" height="1">
              <TBODY>
              <tr>
                <TD height=1 width="4"></TD>
                <TD align="right" height="1">
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="410" height="1">
                   
                  <tr>
<font face="Arial">

<%
rs.movefirst
   rs.pagesize = mypagesize
   maxcount = Cint(rs.pagecount)
   rs.absolutepage = mypage
   
   howmanyrecs = 0
   howmanyfields = rs.fields.count -1
   Do While Not RS.EOF AND howmanyrecs < rs.pagesize
   counter = counter + 1
   If counter mod 2 = 0 then
      color = "#FFFFFF"
   Else
      color = "#F0F0F0"
   End If
%> </font>

                    <td bgcolor="<%= color %>" width="359" height="1" valign="top" style="padding:0; ">
                        <font size="1" face="Arial" color="#800000"> 
                        <%if rs("VIP") = "Ja" then%>
                        <p>
                        <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/VIP.gif" alt="<%=rs("username")%> är VIP medlem!" width="11" height="10"><%else%><%end if%><img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="2" height="1"><a href="krypin.asp?checkid=<%=rs("id1")%>"><%=Rs("av")%></a></font><font face="Arial" size="1"><b>
                    </b></font><font color="#800000" face="Arial" size="1"> <%=left(rs("kon"),1)%>
       <%
        newage = DateDiff ("d", rs("alder"), Now)
		newage = newage - (newage Mod 365)
		newage = newage / 365
		response.write(newage)%>
		
		</font><font face="Arial" size="1"> 
                    från <%=rs("stad")%> - 

<%postDate = cdate(rs("datum"))
days = datediff("d",postDate,now())
if days = 0 then
response.write "<font color='#800000'>idag "& "</font>" & FormatDateTime(postDate,3)
elseif days = 1 then
response.write "<font color='#000080'>igår "& "</font>" & FormatDateTime(postDate,3) 
else
response.write postDate
end if%>

<br>&nbsp;<%=rs("Text")%></font></td>
                    
                     </font><font face="Arial">
  
                     
                     
             </tr> 

   
<%
RS.Movenext
howmanyrecs = howmanyrecs + 1
Loop
RS.Close
%>  </font>
 <% ELSE %>
                </table>
                               
                </TD>  
              </tr>
              <tr>
                    <td height="1" colspan="2" align="center">
                    <font size="1" face="Arial">
                    <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="1" height="1"><br>
                    <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="1" height="1"><img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/Streck.gif" width="407" height="1"></font></td>
                  </tr>
                 
            <tr>
           
 <td height="1" colspan="2" align="center">
                   <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="406" height="1">
                      <tr> 
                      
                        <td width="404" height="1">
                        <p align="center">
                    <font face="Arial" size="1">
                    <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="1" height="1"><br>
                    Tyvärr denna grupp är tom!<%=rs("av")%><br>
                    
                    <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="1" height="1"></font></td>
                    
                      </tr> <%End if%>
                    </table>
                    </td>
                  </tr>
              </TBODY></TABLE>

             <div align="center">
               <center>

            <TABLE cellSpacing=0 cellPadding=0 width=415 border=0 height="4" style="border-collapse: collapse" bordercolor="#111111">
              <tr>
                <TD height="1" colspan="3">
                <p align="center">
                    <font face="Arial">
                    <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/Streck.gif" width="407" height="1"></font></TD>
              </tr>
              <tr>
                <TD height="1" width="24">
                <font face="Arial" size="1">
                <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/Meny/foregaende.GIF" width="21" height="11"><IMG height=1 src="file:///C:/Inetpub/wwwroot/default-filer/1x1.gif" 
              width=5></font></TD>
                <TD height="1" width="371">
                <%
   If maxcount <> 0 then
   pad = "0"
   scriptname = request.Servervariables("script_name")
   for counter = 1 to maxcount
   If counter >= 10 then
      pad = ""
   End If
ref = "<a href='" & scriptname & "?sida=" & counter & "&pagesize=" & mypagesize & "&tillid=" & Request.QueryString("tillid") & "'>" & pad & counter & "</a> "
   response.write ref & " "
   Next
   End If
%><font size="1" face="Arial"> </font><font size="1" face="Arial"><br>
                <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/1pxtrans2.gif" width="4" height="4"></font></TD>
                <TD height="1" width="20">
                <font face="Arial" size="1">
                <img border="0" src="file:///C:/Inetpub/wwwroot/Bilder/Meny/nasta.gif" width="21" height="11"></font></TD>
              </tr>
              </TABLE> 
               </center>
             </div>
     </TD>
      
          </TR>
              </TABLE>
      
</body>
</html>
```

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/14277-paging
