<%@LANGUAGE = VBScript%>
<%
' DEFINISCO LE VARIABILI CHE MI SERVONO PER L' APPLICAZIONE
Dim sc, cn, rs, contatore
' DEFINISCO LA STRINGA DI CONNESSIONE
sc = " "
sc = sc & " driver={Microsoft Access Driver (*.mdb)};dbq="
sc = sc & Server.MapPath(" database.mdb" )
' IMPOSTO LA CONNESSIONE ED IL RECORDSET
Set cn = Server.CreateObject(" ADODB.Connection" )
Set rs = Server.CreateObject(" ADODB.Recordset" )
' APRO LA CONNESSIONE COL DATABASE
cn.Open sc
%>
<html>
<head>
<title>Paginazione a colonne sui record di un db in ASP</title>
</head>
<body>
<table border=" 1" ><tr>
<%
' IMPOSTO A 0 IL CONTATORE
contatore = 0
' APRO IL RECORDSET
rs.Open " SELECT nome FROM utenti ORDER BY nome ASC" , cn, 1
' ESEGUO IL CICLO
While rs.EOF = False
' IMPOSTO LA PAGINAZIONE A 3 COLONNE ED N RIGHE
' IN FUNZIONE DEL NUMERO DI RECORD PRESENTI NEL DB
If contatore = 3 Then
contatore = 0
Response.Write " </tr><tr>"
End If
%>
<td><%=rs(" nome" )%></td>
<%
rs.MoveNext
' INCREMENTO IL VALORE DEL CONTATORE
contatore = contatore + 1
Wend
rs.Close
%>
</tr></table>
</body>
</html>
<%
' UN PO DI PULIZIA...
Set rs = Nothing
cn.Close
Set cn = Nothing
%>