|
|
Links
<%
dim conn 'db connection
dim rs 'recordset
dim sql 'sql query
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
dim iRecordsShown
dim i 'counter
iPageSize = 10 'you can edit how many messages per page
if request("page")="" then
iPageCurrent = 1
else
iPageCurrent = cint(request.querystring("page"))
end if
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.Open dsn'open connection
sql = "select * from links order by codigo desc"
rs.Open sql, conn,adOpenStatic, adLockReadOnly, adCmdText
rs.PageSize = iPageSize
rs.CacheSize = iPageSize
iPageCount = rs.PageCount
iRecordsShown = 0
if rs.eof AND Rs.bof =True Then
response.write "• Nenhum link cadastrado!"
else
RS.AbsolutePage = iPageCurrent
Do While iRecordsShown < iPageSize And Not Rs.EOF
%>
<%
iRecordsShown = iRecordsShown+1
rs.movenext
loop
%>
<%
if ipagecount > "1" then
for i=1 to ipagecount
response.write "" & i & " "
next
end if
%>
Página <%= iPageCurrent %> de <%= iPageCount %>
<%
end if
rs.close
set rs= nothing
conn.close
set conn = nothing
%> |
|
|
|