Ir para conteúdo
Fórum Script Brasil
  • 0

Paginação


Guest - Fernando -

Pergunta

Guest - Fernando -

Seguinte galera abaixo segue uma página com paginação:

<!--#include file="conec2.inc" -->

<%

dim mostra,num_and,cod

num_and = request.Form("menu")

  cod = num_and

  if cod = 1 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 2 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 3 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 4 then

    mostra = "02º andar"

  end if

  if cod = 5 then

    mostra = "03º andar"

  end if

  if cod = 6 then

    mostra = "04º andar"

  end if

  if cod = 7 then

    mostra = "05º andar"

  end if

  if cod = 8 then

    mostra = "07º andar"

  end if

  if cod = 9 then

    mostra = "08º andar"

  end if

  if cod = 10 then

    mostra = "09º andar"

  end if

  if cod = 11 then

    mostra = "10º andar"

  end if

  if cod = 12 then

    mostra = "11º andar"

  end if

  if cod = 13 then

    mostra = "12º andar"

  end if

  if cod = 14 then

    mostra = "14º andar"

  end if

  if cod = 15 then

    mostra = "15º andar"

  end if

  if cod = 16 then

    mostra = "17º andar"

  end if

  if cod = 17 then

    mostra = "18º andar"

  end if

  if cod = 18 then

    mostra = "19º andar"

  end if

  if cod = 19 then

    mostra = "20º andar"

  end if

  if cod = 20 then

    mostra = "21º andar"

  end if

  if cod = 21 then

    mostra = "22º andar"

  end if

  if cod = 22 then

    mostra = "26º andar"

  end if

  if cod = 23 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 24 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 25 then

    response.Write "<center>" & "Por favor escolha um andar."

  end if

  if cod = 26 then

    mostra = "bloco 05"

  end if

  if cod = 27 then

    mostra = "bloco 06"

  end if

  if cod = 28 then

    mostra = "bloco 07"

  end if

if Request.queryString("pagina") = "" then

pagina = 1

else

pagina = cint(Request.queryString("pagina"))

end if

'O RESTO DA CONEXÃO ESTA NO INCLUDE ACIMA

set Cx = Server.createObject("ADODB.Connection")

Cx.commandTimeout = 900

Cx.cursorLocation = 3

Cx.open Conn

sub destroi

Cx.close

set Rs = nothing

set Cx = nothing

end sub

comandoSql = "SELECT * FROM ramais WHERE andar = '"&mostra&"' "

set Rs = Server.createObject("ADODB.Recordset")

Rs.Open comandoSql, Cx

Rs.cacheSize = 30

Rs.pageSize = 30

Rs.absolutePage = pagina

%>

<html>

<head>

<title>..:: RAMAIS ::..</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language=JavaScript src="../js/janela.js" type=text/javascript></script>

<style>

a {text-decoration:none;}

a:hover{color:white ;background-color: black; text-decoration: none }

</style>

<style type="text/css">

<!--

.linha {

border: 1px ridge #000000;

}

.lista {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 10px;

line-height: 8px;

font-variant: small-caps;

text-transform: lowercase;

color: #000000;

background-attachment: scroll;

background-color: #dcdcdc;

border: 1px ridge #000000;

}

-->

</style>

</head>

<body bgcolor="#dcdcdc" text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td><table width="750" border="0" align="center" cellpadding="0" cellspacing="0" class="lista">

   

      <tr>

        <td height="144"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

  <!--#include file="list.inc"-->

          <tr bgcolor="#3399FF">

            <td colspan="4" bgcolor="#FFCC33"><div align="left">

              <table width="100%" border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td width="25%"><div align="left"><font size="1" face="Verdana"><strong>Usu&aacute;rio</strong></font></div></td>

                  <td width="25%"><div align="left"><font size="1" face="Verdana"><strong>Ramal</strong></font></div></td>

                  <td width="25%"><div align="left"><font size="1" face="Verdana"><strong>Setor</strong></font></div></td>

                  <td width="25%"><div align="left"><font size="1" face="Verdana"><strong>Andar</strong></font></div></td>

                </tr>

              </table>

            </div>              </td>

            </tr>

        </table>

          <font color="#FF0000" size="1" face="Verdana"><strong>

<%

for registro = 1 to 3

%>

          </strong></font>

          <%

if (cor = "../img/cor.gif") then

cor = "../img/cor2.gif"

else

cor = "../img/cor.gif"

end if

%>

          <table width="100%" border="0" cellpadding="0" cellspacing="0">

            <tr>

              <td width="25%" background="<%=cor%>"><div align="left"><strong><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=rs("usuario")%></font></strong></div>

              </td>

              <td width="25%" background="<%=cor%>"><div align="left"><strong><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=rs("ramal")%></font></strong></div>

              </td>

              <td width="25%" background="<%=cor%>"><div align="left"><strong><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=rs("setor")%></font></strong></div>

              </td>

              <td width="25%" background="<%=cor%>"><div align="left"><strong><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=rs("andar")%></font></strong></div>

              </td>

            </tr>

          </table>

                <table width="100%" border="0" cellspacing="0" cellpadding="0">

            <tr bgcolor="#CCCCCC">

              <td width="39%" height="38"><div align="center"><a href="../index.asp"><font color="#FF0000" size="1" face="Verdana"><strong>

                <%

  Rs.moveNext

  if Rs.EOF then exit for

  Next

  %>

  <%

  For i = 1 to Rs.pageCount

Response.write "<a href='segundo.asp?pagina="& i &"'>"& i & "</a> "

Next

destroi

  %>

              </strong></font></a></div>

              </td>

              <td width="39%"><div align="center"><font color="#FF0000" size="1" face="Verdana"><strong><a href="../index.asp"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Voltar</strong></font></a>

               

                </strong></font></div></td>

              <td width="22%"><!--#include file="update.inc"--></td>

            </tr>

          </table></td>

      </tr>

    </table></td>

  </tr>

</table>

</body>

</html>

sueguinte ai eu coloquei para aparecer apenas 3 registros por página mais o que acontece é que aparecem os 3 primeiros registros da minha consulta e depois não cria as outras páginas com os outros próximos 3 registros.

Porém o mais estranho é se eu colocar a minha consulta assim:

comandoSql = "SELECT * FROM ramais"

ele retorna tudo certinho criando as páginas e mostrando os 3 registros por página.

se alguém souber e puder me ajudar a gradeo desde já!!!

Link para o comentário
Compartilhar em outros sites

3 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.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...