codice:
<%@ Language=VBScript %>
<%

pagina=CInt(request.QueryString("pagina"))


strq = "SELECT * FROM messaggi where ok='S' ORDER BY data DESC"

set conn = server.createObject("ADODB.Connection")
strprov = "DRIVER=Microsoft Access Driver (*.mdb); DBQ=" & Server.MapPath("dite la vostra/Messaggi.mdb")
conn.open strprov

set rst=Server.CreateObject("ADODB.Recordset")
set RstCount=Server.CreateObject("ADODB.Recordset")

strcount="SELECT COUNT('ID') as count FROM messaggi where ok='S'"

rst.Open strq, conn
RstCount.open strcount, conn 

messPerPagina = 5
rst.MoveFirst
TotMessaggi=rstcount("count")

 
messLastPage=TotMessaggi mod messPerPagina
if messLastPage = 0 then
	messLastPage = messPerPagina
end if

nPagine=((TotMessaggi-1) \ messPerPagina) + 1






if pagina > nPagine then pagina=nPagine


IndiceMessaggio=1
while IndiceMessaggio <  (((pagina - 1) * messPerPagina) + 1)
	rst.movenext
	IndiceMessaggio=IndiceMessaggio+1
wend
if pagina = nPagine then
	messPerPagina=messLastPage
end if

IndiceMessaggio=1

response.write "messaggi="

while (not rst.EOF) and (IndiceMessaggio <= messPerPagina)


	response.write "<font color='#00CC00'>" & nom & " - " & citt & "</font>
"
	response.write mess
	response.write "


"
	rst.movenext
	IndiceMessaggio=IndiceMessaggio+1
wend

response.write "&eseguito=1&nPagine=" & CStr(nPagine)

'end if
%>