<%@ Language=VBScript %>
<% response.buffer=true %>
<% Server.ScriptTimeout = 300 %>
<html>
<head>
<title>Creamweb.it - Paginazione</title>
</head>
<BODY>
Paginazione dei risultati di una query
<%
titolo_categoria = trim(request.querystring("titolo_categoria"))
cat_secondaria = trim(request.querystring("cat_secondaria"))
note = trim(request.querystring("note"))
id = trim(request.querystring("id"))
iPageSize = 8 'NUMERO RECORD PER PAGINA
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
strSQL = "SELECT * FROM tbl_Prodotti WHERE titolo_categoria = '"& titolo_categoria &"' OR cat_secondaria = '"& cat_secondaria &"' OR note = '"& note &"'"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.PageSize = iPageSize
objRS.CacheSize = iPageSize
objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
reccount = objRS.recordcount
iPageCount = objRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "
Non sono stati trovati prodotti"
Else
objRS.AbsolutePage = iPageCurrent
iRecordsShown = 0
%>
<%
'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
cont=1
Do While iRecordsShown < iPageSize And Not objRS.EOF
Response.Write "
" & objRS("nome") & " | "
Response.Write "" & objRS("titolo_categoria") & " | "
Response.Write "" & objRS("prezzo") & "</p>"
Cont = Cont + 1
'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
iRecordsShown = iRecordsShown + 1
objRS.MoveNext
Loop
'PULIZIA DEGLI OGGETTI ADO
objRS.Close
Set objRS = Nothing
%>
<%End if%>
<%If ipagecount <> 1 Then%>
<%end if%>
<%
objConn.Close
Set objConn = Nothing
%>
</body>
</html>