Ok, ho preso un esempio trovato qui sul forum, ho impostato la visualizzazione di 1 record per pagina, in realtà ne vedo 2, e cambiando pagina rimangono gli stessi (nb: le foto sono 2)
che può essere?
codice:
<%
function excess(argValue)
if not (int(argValue) = argValue) then argValue = int(argValue)+1
excess = argValue
end function
function cleanLong(argValue)
on error resume next
if argValue = "" then : cleanLong = clng(0) : else : cleanLong = clng(trim(argValue)) : end if
if err.number <> 0 then cleanLong = 0
on error goto 0
end function
dim conn, rs, SQL, SQLwhere
Set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mappath("/laderchi2/db1.mdb") & " ; Persist Security Info = False"
dim wbp_recordPerPage, wbp_totalRecords, wbp_totalPages, wbp_currentRecord, wbp_currentPage, wbp_lastcurrentRecord
dim wbp_isEmpty
dim wbp_baseQuerystring, wbp_basePage
dim argPage
'*** EDIT *** impostare quanti record in ogni pagina
wbp_recordPerPage = 1
argPage = cleanLong(request.QueryString("page"))
if argPage < 1 then argPage = 1
'* 1. selezionare SOLO gli id
'* 2. applicare in questa query gli eventuali filtri di selezione
SQL = "SELECT idfoto FROM tabellafoto where IDCane = 3 "
rs.open SQL, Conn, 3, 3
'* impostazione variabili di navigazione (pagine)
wbp_totalRecords = cint(rs.recordcount)
wbp_totalPages = excess(wbp_totalRecords / wbp_recordPerPage)
wbp_currentRecord = ((argPage - 1) * wbp_recordPerPage) + 1
if wbp_currentRecord > wbp_totalRecords then
wbp_currentPage = 1
wbp_currentRecord = ((wbp_currentPage - 1) * wbp_recordPerPage) + 1
else
wbp_currentPage = argPage
end if
wbp_lastcurrentRecord = wbp_currentRecord + wbp_recordPerPage - 1
if wbp_lastcurrentRecord > wbp_totalRecords then wbp_lastcurrentRecord = wbp_totalRecords
SQLwhere = ""
wbp_isEmpty = true
if not rs.eof then
'* spostamento nel recordset
rs.pagesize = wbp_recordPerPage
rs.absolutepage = wbp_currentPage
wbp_isEmpty = false
'* creazione seconda query (recordset completo, solo per gli ID selezionati nella prima query)
dim ii
for ii=0 to wbp_recordPerPage-1
'*** EDIT *** al posto di ID mettere il nome del campo ID della vostra tabella
SQLwhere = SQLwhere & " or id = " & rs("idfoto") & ""
rs.movenext
if rs.eof then exit for
next
set ii = nothing
rs.close
SQLwhere = right(SQLwhere,len(SQLwhere)-3)
end if
if not wbp_isEmpty then
'*** EDIT *** selezionare TUTTI i campi necessari
SQL = "SELECT * FROM tabellafoto WHERE IDCane = 3 "
set rs = conn.execute(SQL)
while not rs.eof
'*** EDIT *** STAMPA DEL RECORDSET (da personalizzare secondo le esigenze)
%><img src = "/laderchi2/<%=rs("linkfoto")%>" /> <%
rs.movenext
wend
%>
<div class="page_navigator">
<span class="page_view"><%
'*** EDIT *** pagina a cui puntare
wbp_basePage = "paginazione.asp"
'*** EDIT *** querystring aggiuntiva ( es: "&sort=date" )
wbp_baseQuerystring = ""
%></span>
<span class="topic-pages"><%
if wbp_totalPages > 1 then
%><span class="page_pagesnav"><%=wbp_totalPages%> pagine [ <%
if wbp_currentPage > 1 then
if wbp_currentPage > 2 then
%><< <%
end if
%>< <%
if wbp_currentPage - 3 > 0 then%><%=wbp_currentPage-3%> <% end if
if wbp_currentPage - 2 > 0 then%><%=wbp_currentPage-2%> <% end if
if wbp_currentPage - 1 > 0 then%><%=wbp_currentPage-1%> <% end if
end if
%><%=wbp_currentPage%> <%
if wbp_currentPage < wbp_totalPages then
if wbp_currentPage + 1 < wbp_totalPages + 1 then%><%=wbp_currentPage+1%> <% end if
if wbp_currentPage + 2 < wbp_totalPages + 1 then%><%=wbp_currentPage+2%> <% end if
if wbp_currentPage + 3 < wbp_totalPages + 1 then%><%=wbp_currentPage+3%> <% end if
%>> <%
if wbp_currentPage < wbp_totalPages - 1 then
%>>> <%
end if
end if
%> ]</span><%
else
%>1 pagina<%
end if%>
</span>
</div><%
else
'*** EDIT *** se il recordset è vuoto...
response.write "nessun record"
end if
%>