Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

berkowitz

Conclusão de Paginação

Recommended Posts

Pessoal, tenho uma tabela ENORME de e-mails, e preciso fazer uma paginação para apresentar de 30 em 30 na tela.

 

Fiz a página abaixo e está funcionando, mas o único problema é que não sei como definir o número de registros por página (o famoso PageSize). Como faço isso aqui na minha página??

 

Segue a página:

 

<html>

<head>

<title>Consulta BD</title>

</head>

<body>

<center><h2><font face="Arial" size="4"><b>Formulário de Consulta</b></font></h2></center>

<table border=0 width="80%" align=center>

<%

Set Conexao = Server.CreateObject("ADODB.Connection")

Conexao.Open "DBQ=E:\home\cecresp\dados\banco_flashmail.mdb;Driver={Microsoft Access Driver (*.mdb)};"

ComandoSQL = "SELECT * FROM flashmail"

Set bd = Conexao.Execute(ComandoSQL)

If Not bd.EOF Then

bd.Move Request.QueryString("n")

%>

<tr>

<td width="20%" align=right valign=top> <font face="Arial" size="2">mail:</font></td>

<td width="80%" align=left valign=top> <font face="Arial" size="2"> <b><%=bd("mail")%></b></font></td>

</tr>

<%

Else

%>

<center><font face="Arial" size="2"><b> Nenhum valor encontrado</b></font> </center>

<%

End If

%>

</table>

<br><center>

 

<%

If Request.QueryString("n") > 0 then

Response.Write "<a href=" & Request.ServerVariables("SCRIPT_NAME") & "?n=" & Request.QueryString("n") - 1 & "><< Anterior</a>  "

End If

 

bd.MoveNext

If Not bd.EOF then

Response.Write "  <a href=" & Request.ServerVariables("SCRIPT_NAME") & "?n=" & Request.QueryString("n") + 1 & ">Próximo >></a>"

End If

 

Conexao.Close

Set bd = Nothing

Set Conexao = Nothing

%>

 

</table>

</body>

</html>

 

Conto com vocês!!

 

OBRIGADO!!

 

T +

 

|* RAFAEL *|

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ae eu refiz o código procê:

<html><head><title>Consulta BD</title></head><body><center><h2><font face="Arial" size="4"><b>Formulário de Consulta</b></font></h2></center><table border=0 width="80%" align=center><%RegistrosPag = 10n = Request("n")If n = "" Thenn = "1"End Ifn = CInt(n)Set Conexao = Server.CreateObject("ADODB.Connection")Conexao.Open "DBQ=E:\home\cecresp\dados\banco_flashmail.mdb;Driver={Microsoft Access Driver (*.mdb)};"ComandoSQL = "SELECT * FROM flashmail"Set bd = Server.CreateObject("ADODB.Recordset")bd.Open ComandoSQL, Conexao, 1If Not bd.EOF And Not bd.BOF Thenbd.Move n - 1For i = n to n + RegistrosPag - 1If not bd.EOF and not bd.BOF Then%><tr> <td width="20%" align=right valign=top> <font face="Arial" size="2">mail:</font></td><td width="80%" align=left valign=top> <font face="Arial" size="2"> <b><%=bd("mail")%></b></font></td></tr><%bd.MoveNextEnd IfNextElse%><tr> <td height="100" align="center"><center><font face="Arial" size="2"><b>Nenhum valor encontrado</b></font></center></td></tr><%End If%></table><br><center><%If n > 1 Then%><a href="<%=Request.ServerVariables("URL")%>?n=<%=n - RegistrosPag%>"><< Anterior</a> <%End IfIf bd.RecordCount > RegistrosPag Thennum = 0For i = 1 to bd.RecordCount step RegistrosPagnum = num + 1If Int(n) = i Then%><%=num%> <%Else%><a href="<%=Request.ServerVariables("URL")%>?n=<%=i%>"><%=num%></a> <%End IfNextEnd If%><%If bd.RecordCount - (n + RegistrosPag) > -1 Then%> <a href="<%=Request.ServerVariables("URL")%>?n=<%=n + RegistrosPag%>">Próxima >></a><%End If%></b></font><%Set bd = NothingSet con_pap = Nothing%>
Vê se funciona agora....

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.