Ciao.
Con la ricerca ho trovato questo tipo di paginazione ASP + MySQL:
codice:
Function excess(argValue)
if not (int(argValue) = argValue) then argValue = int(argValue)+1
excess = argValue
end Function
pageSize = 10
if(len(Request.QueryString("pagina"))=0)then
currentPage = 1
else
currentPage = CInt(Request.QueryString("pagina"))
end if
sql_count = " SELECT * "
sql_count = sql_count & " , COUNT(*) AS CNT "
sql_count = sql_count & " , COUNT(TIPO) AS totale_tipo "
sql_count = sql_count & " FROM "
sql_count = sql_count & " tbl "
sql_count = sql_count & " GROUP BY "
sql_count = sql_count & " TIPO, DATA "
sql_count = sql_count & " ORDER BY "
sql_count = sql_count & " DATA ASC "
sql_count = sql_count & " LIMIT " & (currentPage - 1) * pageSize & ", " & pageSize
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open sql_count, cn
If Not RS.eof Then
recordCount = RS("CNT")
pageCount = excess(clng(recordCount) / clng(pageSize))
for i = 1 to pageCount
Response.Write("" & i & " ")
next
end if
RS.Close
Set RS = Nothing
cn.Close
Set cn = Nothing
A me non funziona nel senso che restituisce sempre questi valori:
PageSize = 10
Numero records = 1
PageCount = 1
Mentre i numeri di records sono molti di più....