Salve a tutti, sono nuovissimo, ho fatto delle ricerche nel forum e ho trovato uno script per la paginazione, funziona bene, ma se lo incollo nella mia pagina, non funziona come dovrebbe, o come l'esempio!!!
Questo è il codice:
codice:
<%
iPageSize = 2 'NUMERO RECORD PER PAGINA
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open session("Connection")
strSQL="SELECT * FROM tbl_news ORDER BY data DESC"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.PageSize = iPageSize
objRS.CacheSize = iPageSize
objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
iPageCount = objRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "<table width='90%' border='0' align='center' cellpadding='0' cellspacing='0' class='main'><tr><th>Non sono state trovate news.</th></tr></table>"
Else
objRS.AbsolutePage = iPageCurrent
%>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
<%
if (not objRS.EOF) then
do until objRS.eof
response.Write "<tr>"
response.Write "<th width='15%' align='left'>" & objRS.fields("data") & "</th>"
response.Write "<th align='left'> " & objRS.fields("titolo") & "</th>"
response.Write "</tr><tr>"
response.Write "<td colspan='2'> " & objRS.fields("messaggio") & "</td>"
response.Write "</tr><tr>"
response.Write "<td colspan='2'></td>"
response.Write "</tr>"
objRS.movenext
loop
end if
%>
</table>
<%End if%>
<%If ipagecount <> 1 Then%>
<center>
<table>
<tr valign="middle">
<td width="50%" align="center" valign="middle">
[
<%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
[img]/images/first.gif[/img]
<%end if%>
<%if iPageCurrent > 1 then%>
[img]/images/pre.gif[/img]
<%end if%>
<%if iPageCount > 2 then
if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
else
da_pag = 1
fino_a_pag = iPageCount
end if%>
<%for i = da_pag to fino_a_pag%>
<%if i = iPageCurrent then%>
<font color="red"><%=i%></font>
<%else%>
<%=i%>
<%end if%>
<%next%>
<%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
[img]/images/next.gif[/img]
<%end if%>
<%if iPageCurrent+1 < iPageCount then%>
[img]/images/last.gif[/img]
<%end if%>
]
</td>
</tr>
<tr>
<td colspan="2" align="center"><font face="verdana" size="1" color="#FFFFFF">
<center>
Pagina
<font color="#FF0000"><%=iPageCurrent%></font>
di
<font color="#FF0000"><%=iPageCount%></font>
</center>
</font></td>
</tr>
</table>
</center>
<%
end if
objConn.Close
Set objConn = Nothing
%>
il sito di esempio è: http://test.2gnet.com/news/index.asp