problem pagination overflow
Code:
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
|
<%
Nmax = 10 ' nombre par page
Ndeb = Cint(request.queryString("num"))
' nombre total de fiches
SQL="SELECT count(*) FROM [fichiers]"
RS2 = conn.execute(SQL)
Ntotal = RS2(0) - 1 ' commence à 0
' sélectionne les fiches de la table
Set RS = server.createobject("ADODB.Recordset")
SQL="SELECT TOP " & (Ndeb+Nmax)_
& " * FROM [fichiers]"
RS.Open SQL,Conn , 3, 3
' Avance à la 1ère
RS.Move(Ndeb)
' tant qu'il reste des fiches
while not RS.eof
' affiche le champ
response.write RS("cat_titre") & "<br>"
' fiche suivante
RS.MOVENEXT
wend%>
<br>
<table cellpadding=3><tr>
<% ' NAVIGATION
' Des fiches avant ?
if Ndeb > 0 then%>
<td>
<A href="?num=0">Début</A>
<A href="?num=<%=Ndeb-Nmax%>">Retour</A>
</td>
<%end if%>
<td>
<% ' Page courante
Npag = int(Ndeb/Nmax)+1 : Npag2 = Npag-1
tmp = "<b>" & Npag & "</b>"
' Max 9 pages avant
while Npag2>0 AND Npag2>Npag-10
tmp = "<A href='?num=" & ((Npag2-1)*Nmax)_
& "'>" & Npag2 & "</A> " & tmp
Npag2 = Npag2-1
wend
' Max 9 pages après
Npag2 = Npag
while Npag2*Nmax<=Ntotal AND Npag2<Npag+9
Npag2 = Npag2+1
tmp = tmp & " <A href='?num=" & ((Npag2-1)*Nmax)_
& "'>" & Npag2 & "</A>"
wend
response.write tmp
%>
</td>
<% ' Des fiches après ?
if Ntotal>Ndeb+Nmax then%>
<td>
<A href="?num=<%=Ndeb+Nmax%>">Suite</A>
<A href="?num=<%=int(Ntotal/10)*10%>">Fin</A>
</td>
<%end if
RS.close : set RS=nothing%>
</tr></table>
</BODY></HTML>
<% conn.close : Set conn=nothing %> |
Bonjour
j'ai fait ce code et il m'as donné comme erreur "overflow"
normalement il doit afficher juste 10 enregistrements mais il affcihe tout et lorsque je click sur page 2 3 ou bien suite il me donne cette erreur.
Merci