Arbor - Manoscritti greci
<%
displayRecs = 40
recRange = 40
MyColNum = 5 'How many Columns do you want or how many records per row do you want?
' Check for a START parameter
If Request.QueryString("start").Count > 0 Then
startRec = Request.QueryString("start")
Session("ads_REC") = startRec
Else
startRec = Session("ads_REC")
if not isnumeric(startRec) or startRec = "" then
'reset start record counter
startRec = 1
Session("ads_REC") = startRec
End If
End If
' Open Connection to the database
Set objConn =Server.CreateObject("ADODB.Connection")
objConn.Open ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("SOLmanoscritti.mdb"))
' Build Query
strsql = "select * from [greci] order by ID Asc"
'response.write strsql
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, objConn, 1, 2
totalRecs = rs.RecordCount
%>
<%
'Avoid starting record > total records
if clng(startRec) > clng(totalRecs) then
startRec = totalRecs
end if
'Set the last record to display
stopRec = startRec + displayRecs - 1
'Move to first record directly for performance reason
recCount = startRec - 1
if not rs.eof then
rs.movefirst
rs.move startRec - 1
end if
recActual = 0
Do While (NOT rs.EOF) AND (recCount < stopRec)
recCount = recCount + 1
If Clng(recCount) >= Clng(startRec) Then
recActual = recActual + 1
x=x
%>
<%
a_file = rs("img")
b_file = rs("autore")
x_file = rs("titolo")
z_file = rs("link")
t_file = rs("ID")
y_file = rs("data")
m_file = rs("collocazione")
x=x+1
%>
<%
if x= MyColNum then
Response.Write "
"
x=0 'resets x to 0 after x has reached 5 and starts over with a new row
end if
end if
rs.MoveNext
Loop
%>
<%
if totalRecs > 0 then
' Find out if there should be Backward or Forward Buttons on the table.
If startRec = 1 Then
isPrev = False
Else
isPrev = True
PrevStart = startRec - displayRecs
If PrevStart < 1 Then PrevStart = 1 %>
[<< Precedente]
<%
End If
' Display Page numbers
If (isPrev OR (NOT rs.EOF)) Then
If (NOT isPrev) Then Response.Write "
"
x = 1
y = 1
dx1 = ((startRec-1)\(displayRecs*recRange))*displayRecs*recRange+1
dy1 = ((startRec-1)\(displayRecs*recRange))*recRange+1
If (dx1+displayRecs*recRange-1) > totalRecs then
dx2 = (totalRecs\displayRecs)*displayRecs+1
dy2 = (totalRecs\displayRecs)+1
Else
dx2 = dx1+displayRecs*recRange-1
dy2 = dy1+recRange-1
End If
While x <= totalrecs
If x >= dx1 and x <= dx2 Then
If Clng(startRec) = Clng(x) Then %>
<%=y%>
<% Else %>
<%=y%>
<% End If
x = x + displayRecs
y = y + 1
elseif x >= (dx1-displayRecs*recRange) and x <= (dx2+displayRecs*recRange) then
if x+recRange*displayRecs < totalRecs then %>
<%=y%>-<%=y+recRange-1%>
<% else
ny=(totalRecs-1)\displayRecs+1
if ny = y then %>
<%=y%>
<% else %>
<%=y%>-<%=ny%>
<% end if
end if
x=x+recRange*displayRecs
y=y+recRange
else
x=x+recRange*displayRecs
y=y+recRange
End If
Wend
End If
' Next link
If NOT rs.EOF Then
NextStart = startRec + displayRecs
isMore = True %>
[Successivo >>]
<% Else
isMore = False
End If %>
<% If stopRec > recCount Then stopRec = recCount %>
Immagini da <%= startRec %> a <%= stopRec %> di <%= totalRecs %>
<% Else %>
No records found!
<% End If %>
Back to Top