<!--#include file="conexaoNwind.inc" -->
<!--#include file="adcvbs.inc" -->
<html>
<head>
<title>Paginação - GetRows - Ursolouco</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: Verdana;
font-size: 10px;
color: #000000;
}
a {
text-decoration: none;
}
a:link {
color: #000099;
}
a:visited {
color: #330099;
}
a:hover {
text-decoration: underline;
}
-->
</style>
</head>
<body>
<p>
<%
Inicio = Request.QueryString("Inicio")
Final = Request.QueryString("Final")
Quantidade = Request.QueryString("Quantidade")
If Not isNumeric(Inicio) or Len(Inicio)=0 Then
Inicio = 0
Else
Inicio = CInt(Request.QueryString("Inicio"))
End If
If Not isNumeric(Final) or Len(Final)=0 Then
Final = 0
Else
Final = CInt(Request.QueryString("Final"))
End If
If Not isNumeric(Quantidade) or Len(Quantidade)=0 Then
Quantidade = 5
Else
Quantidade = Quantidade
End If
If Not isArray(ArrRs) Then
Set Rs = Server.CreateObject("Adodb.recordset")
strSQL = "SELECT * FROM Customers;"
Set Rs = Conn.Execute(strSQL)
ArrRs = Rs.GetRows
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
End If
'ArrRs = Coluna, Linhas na tabela
'Onde: Coluna -> Campo da tabela a ser exibido
'Linha: Registro a ser percorrido de acordo com o Loop
TotalColunas = UBound(ArrRs,1)
TotalRegistros = UBound(ArrRs, 2)+1
If (TotalRegistros - Quantidade) < (Inicio + Quantidade) Then
Quantidade = (TotalRegistros - Inicio)
End If
If Parar > TotalRegistros Then
Parar = TotalRegistros
Else
Parar = Inicio + Quantidade
End If
For I = Inicio To (Parar-1)
For U = 0 To (TotalColunas-6)
Response.Write(ArrRs(U,I) & " " & "-" & " ")
Next
Response.Write("<br>")
Next
response.Write("<br>")
If Inicio > 1 Then
Response.Write("<a href=Pag_GetRows.asp?Inicio=" & (Inicio - Quantidade) & "&" & "Final=" & Parar - Quantidade & "&" & "Quantidade=" & Quantidade & ">")
response.Write("<<<<-- VOLTAR")
Response.Write("</a>")
End If
Response.Write(" " & "<b>" & "|" & "</b>" & " ")
If parar < TotalRegistros Then
Response.Write("<a href=Pag_GetRows.asp?Inicio=" & Inicio + Quantidade & "&" & "Final=" & Parar + Quantidade & "&" & "Quantidade=" & Quantidade & ">")
Response.Write(" AVANÇAR -->>>>")
Response.Write("</a>")
End If
%>
</p>
</body>
</html>
conexaoNwind.inc
<%
cBanco = Server.MapPath("NWIND.mdb")
Set Conn = Server.CreateObject("adodb.connection")
strConn = "Provider = Microsoft.jet.oledb.4.0; Data Source ="& cBanco &";"
Conn.Open(strConn)
%>
Já havia deixando pendurado aqui na seção, mas como ninguém procura, resolvi novamente colocar aqui.
Pergunta
ursolouco
Paginação de Vetores:
Pag_GetRows.asp
<!--#include file="conexaoNwind.inc" --> <!--#include file="adcvbs.inc" --> <html> <head> <title>Paginação - GetRows - Ursolouco</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { font-family: Verdana; font-size: 10px; color: #000000; } a { text-decoration: none; } a:link { color: #000099; } a:visited { color: #330099; } a:hover { text-decoration: underline; } --> </style> </head> <body> <p> <% Inicio = Request.QueryString("Inicio") Final = Request.QueryString("Final") Quantidade = Request.QueryString("Quantidade") If Not isNumeric(Inicio) or Len(Inicio)=0 Then Inicio = 0 Else Inicio = CInt(Request.QueryString("Inicio")) End If If Not isNumeric(Final) or Len(Final)=0 Then Final = 0 Else Final = CInt(Request.QueryString("Final")) End If If Not isNumeric(Quantidade) or Len(Quantidade)=0 Then Quantidade = 5 Else Quantidade = Quantidade End If If Not isArray(ArrRs) Then Set Rs = Server.CreateObject("Adodb.recordset") strSQL = "SELECT * FROM Customers;" Set Rs = Conn.Execute(strSQL) ArrRs = Rs.GetRows Rs.Close Set Rs = Nothing Conn.Close Set Conn = Nothing End If 'ArrRs = Coluna, Linhas na tabela 'Onde: Coluna -> Campo da tabela a ser exibido 'Linha: Registro a ser percorrido de acordo com o Loop TotalColunas = UBound(ArrRs,1) TotalRegistros = UBound(ArrRs, 2)+1 If (TotalRegistros - Quantidade) < (Inicio + Quantidade) Then Quantidade = (TotalRegistros - Inicio) End If If Parar > TotalRegistros Then Parar = TotalRegistros Else Parar = Inicio + Quantidade End If For I = Inicio To (Parar-1) For U = 0 To (TotalColunas-6) Response.Write(ArrRs(U,I) & " " & "-" & " ") Next Response.Write("<br>") Next response.Write("<br>") If Inicio > 1 Then Response.Write("<a href=Pag_GetRows.asp?Inicio=" & (Inicio - Quantidade) & "&" & "Final=" & Parar - Quantidade & "&" & "Quantidade=" & Quantidade & ">") response.Write("<<<<-- VOLTAR") Response.Write("</a>") End If Response.Write(" " & "<b>" & "|" & "</b>" & " ") If parar < TotalRegistros Then Response.Write("<a href=Pag_GetRows.asp?Inicio=" & Inicio + Quantidade & "&" & "Final=" & Parar + Quantidade & "&" & "Quantidade=" & Quantidade & ">") Response.Write(" AVANÇAR -->>>>") Response.Write("</a>") End If %> </p> </body> </html>conexaoNwind.inc<% cBanco = Server.MapPath("NWIND.mdb") Set Conn = Server.CreateObject("adodb.connection") strConn = "Provider = Microsoft.jet.oledb.4.0; Data Source ="& cBanco &";" Conn.Open(strConn) %>Já havia deixando pendurado aqui na seção, mas como ninguém procura, resolvi novamente colocar aqui.
Abraços!!
[urso]
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.