Ir para conteúdo

POWERED BY:

Arquivado

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

marcos-rj

Problema com Select

Recommended Posts

Estou montando uma agenda em asp, só que não estou conseguindo fazer a visualização/paginação.

 

Não dá nenhuma mensagem de erro, mas não mostra! somente quando clico no mes que quero ver está sendo listado.

 

Ele tem que funcionar assim o select

 

ao entrar na página, senão tiver sido escolhido nenhum mês é mostrado os cadastros para o mes corrente. mas não tá listando! somente quando eu escolho um mes que ele exibe os dados.

 

--------------------------------------

 

código da página:

 

<% Option Explicit %><% Response.Buffer = True %><% session.LCID= 1046  %><!--#include file="config.asp"--><%Dim Dados, TS, Conn, RS, mesinicio, sqlmesinicio =  Request.QueryString("mesinicio")Set Conn = Server.CreateObject("ADODB.Connection")Conn.Open Dadosif mesinicio = "" then	'Seleciona todos os registros ordenando pelo ID	Sql = "SELECT * "	Sql = Sql & "FROM agenda "	Sql = Sql & "Where mes_n = datepart('m', date()) "	Sql = Sql & "Order by Dia asc "Set RS = Server.CreateObject("ADODB.RecordSet")rs.CursorType = 0rs.CursorLocation = 3rs.LockType = 3rs.PageSize = 5rs.CacheSize = 5rs.Open Sql, Conn	'Verifica qual página deve ser exibida	If Request.QueryString("Pagina") <> "" Then  rs.AbsolutePage = Request.QueryString("Pagina")	Else  If Not rs.EOF Then 	 rs.AbsolutePage = 1  End If	End Ifend ifSet RS = Server.CreateObject("ADODB.RecordSet")RS.PageSize = 15RS.Open "select * from agenda where mes='"&mesinicio&"' Order by data", Dados,3,3                                                                                            %><html><head><STYLE type=text/css>A:link { text-decoration: none}A:visited { text-decoration: none}</STYLE><title><%=TS%></title></head><link rel="stylesheet" type="text/css" href="estilo.css"><body topmargin="2" leftmargin="3" vlink="#0000FF"><form method="GET" action="excluir.asp">  <p style="margin-bottom: 0"><i><font face="Verdana" size="4" color="#000080">  <b>Exclusão de Dados</b></font></i></p>  <hr color="#000080" width="30%" size="1" align="left">  <div align="center">    <center>  <table border="1" cellpadding="3" style="border-collapse: collapse" bordercolor="#FFFFFF" width="80%" id="AutoNumber1" height="50">    <tr>      <td width="100%" align="center" bgcolor="#000080" colspan="5" height="20">      <table border="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#000000" width="100%" id="AutoNumber2" bgcolor="#FFFFFF" height="20">        <tr>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Janeiro">JAN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Fevereiro">FEV</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Março">MAR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Abril">ABR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Maio">MAI</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Junho">JUN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Julho">JUL</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Agosto">AGO</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Setembro">SET</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Outubro">OUT</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Novembro">NOV</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Dezembro">DEZ</a></b></td>        </tr>      </table>      </td>    </tr>    <tr><% if not RS.EOF then %>      <td width="16%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">MES</font></b></td>      <td width="12%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">DIA</font></b></td>      <td width="9%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">HORA</font></b></td>      <td width="55%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">PROGRAMAÇÃO</font></b></td>      <td width="8%" bgcolor="#000080" height="22">      <p align="center"><font color="#FFFFFF"><b>      <input type="submit" value=" EXCLUIR" name="Submit"></b></font></td>    </tr><%rs.Movefirstdo until rs.EOF%>    <tr>      <td width="16%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1"> <b><font size="2" color="#FF0000"><%=RS("mes")%></font></b></td>      <td width="12%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("dia")& " - "& RS("dia_s")%></td>      <td width="9%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("hora")%></td>      <td width="55%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <p align="left">  <%=RS("programacao")%></td>      <td width="8%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <input type="checkbox" name="delete" value="<%=RS("ID")%>"></td>    </tr> <% RS.MoveNext  loop %>    <%else%><p><b><font face="Verdana" size="2">Desculpe, não existe programação para o mês:<font face="Verdana" size="2" color="red"> <%=mesinicio%>.</font></b></p><%end if%>  </table>    </center>  </div></form></font><!--#include file="menu.asp"--></body></html><%RS.CloseConn.Close%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Estou montando uma agenda em asp, só que não estou conseguindo fazer a visualização/paginação.

 

Não dá nenhuma mensagem de erro, mas não mostra! somente quando clico no mes que quero ver está sendo listado.

 

Ele tem que funcionar assim o select

 

ao entrar na página, senão tiver sido escolhido nenhum mês é mostrado os cadastros para o mes corrente. mas não tá listando! somente quando eu escolho um mes que ele exibe os dados.

 

--------------------------------------

 

código da página:

 

<% Option Explicit %><% Response.Buffer = True %><% session.LCID= 1046  %><!--#include file="config.asp"--><%Dim Dados, TS, Conn, RS, mesinicio, sqlmesinicio =  Request.QueryString("mesinicio")Set Conn = Server.CreateObject("ADODB.Connection")Conn.Open Dadosif mesinicio = "" then	'Seleciona todos os registros ordenando pelo ID	Sql = "SELECT * "	Sql = Sql & "FROM agenda "	Sql = Sql & "Where mes_n = datepart('m', date()) "	Sql = Sql & "Order by Dia asc "Set RS = Server.CreateObject("ADODB.RecordSet")rs.CursorType = 0rs.CursorLocation = 3rs.LockType = 3rs.PageSize = 5rs.CacheSize = 5rs.Open Sql, Conn	'Verifica qual página deve ser exibida	If Request.QueryString("Pagina") <> "" Then  rs.AbsolutePage = Request.QueryString("Pagina")	Else  If Not rs.EOF Then  	rs.AbsolutePage = 1  End If	End Ifend ifSet RS = Server.CreateObject("ADODB.RecordSet")RS.PageSize = 15RS.Open "select * from agenda where mes='"&mesinicio&"' Order by data", Dados,3,3                                                                                            %><html><head><STYLE type=text/css>A:link { text-decoration: none}A:visited { text-decoration: none}</STYLE><title><%=TS%></title></head><link rel="stylesheet" type="text/css" href="estilo.css"><body topmargin="2" leftmargin="3" vlink="#0000FF"><form method="GET" action="excluir.asp">  <p style="margin-bottom: 0"><i><font face="Verdana" size="4" color="#000080">  <b>Exclusão de Dados</b></font></i></p>  <hr color="#000080" width="30%" size="1" align="left">  <div align="center">    <center>  <table border="1" cellpadding="3" style="border-collapse: collapse" bordercolor="#FFFFFF" width="80%" id="AutoNumber1" height="50">    <tr>      <td width="100%" align="center" bgcolor="#000080" colspan="5" height="20">      <table border="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#000000" width="100%" id="AutoNumber2" bgcolor="#FFFFFF" height="20">        <tr>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Janeiro">JAN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Fevereiro">FEV</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Março">MAR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Abril">ABR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Maio">MAI</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Junho">JUN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Julho">JUL</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Agosto">AGO</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Setembro">SET</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Outubro">OUT</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Novembro">NOV</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Dezembro">DEZ</a></b></td>        </tr>      </table>      </td>    </tr>    <tr><% if not RS.EOF then %>      <td width="16%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">MES</font></b></td>      <td width="12%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">DIA</font></b></td>      <td width="9%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">HORA</font></b></td>      <td width="55%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">PROGRAMAÇÃO</font></b></td>      <td width="8%" bgcolor="#000080" height="22">      <p align="center"><font color="#FFFFFF"><b>      <input type="submit" value=" EXCLUIR" name="Submit"></b></font></td>    </tr><%rs.Movefirstdo until rs.EOF%>    <tr>      <td width="16%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1"> <b><font size="2" color="#FF0000"><%=RS("mes")%></font></b></td>      <td width="12%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("dia")& " - "& RS("dia_s")%></td>      <td width="9%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("hora")%></td>      <td width="55%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <p align="left">  <%=RS("programacao")%></td>      <td width="8%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <input type="checkbox" name="delete" value="<%=RS("ID")%>"></td>    </tr> <% RS.MoveNext  loop %>    <%else%><p><b><font face="Verdana" size="2">Desculpe, não existe programação para o mês:<font face="Verdana" size="2" color="red"> <%=mesinicio%>.</font></b></p><%end if%>  </table>    </center>  </div></form></font><!--#include file="menu.asp"--></body></html><%RS.CloseConn.Close%>

<{POST_SNAPBACK}>

 

 

 

 

 

 

 

 

 

 

 

eu nao vi onde você colocou

o codigo q determina a quantidade de registros a ser mostrado

tipo

 

rs.pagesize = 2 ' seria o recordset =rs e pagesize pra determinar a quantidade de pagina no caso 2 isso deve ficar antes do select se eu nao tiver enganado e isso

 

beleza

 

 

ate mais

Compartilhar este post


Link para o post
Compartilhar em outros sites

Estou montando uma agenda em asp, só que não estou conseguindo fazer a visualização/paginação.

 

Não dá nenhuma mensagem de erro, mas não mostra! somente quando clico no mes que quero ver está sendo listado.

 

Ele tem que funcionar assim o select

 

ao entrar na página, senão tiver sido escolhido nenhum mês é mostrado os cadastros para o mes corrente. mas não tá listando! somente quando eu escolho um mes que ele exibe os dados.

 

--------------------------------------

 

código da página:

 

<% Option Explicit %><% Response.Buffer = True %><% session.LCID= 1046  %><!--#include file="config.asp"--><%Dim Dados, TS, Conn, RS, mesinicio, sqlmesinicio =  Request.QueryString("mesinicio")Set Conn = Server.CreateObject("ADODB.Connection")Conn.Open Dadosif mesinicio = "" then	'Seleciona todos os registros ordenando pelo ID	Sql = "SELECT * "	Sql = Sql & "FROM agenda "	Sql = Sql & "Where mes_n = datepart('m', date()) "	Sql = Sql & "Order by Dia asc "Set RS = Server.CreateObject("ADODB.RecordSet")rs.CursorType = 0rs.CursorLocation = 3rs.LockType = 3rs.PageSize = 5rs.CacheSize = 5rs.Open Sql, Conn	'Verifica qual página deve ser exibida	If Request.QueryString("Pagina") <> "" Then  rs.AbsolutePage = Request.QueryString("Pagina")	Else  If Not rs.EOF Then  	rs.AbsolutePage = 1  End If	End Ifend ifSet RS = Server.CreateObject("ADODB.RecordSet")RS.PageSize = 15RS.Open "select * from agenda where mes='"&mesinicio&"' Order by data", Dados,3,3                                                                                            %><html><head><STYLE type=text/css>A:link { text-decoration: none}A:visited { text-decoration: none}</STYLE><title><%=TS%></title></head><link rel="stylesheet" type="text/css" href="estilo.css"><body topmargin="2" leftmargin="3" vlink="#0000FF"><form method="GET" action="excluir.asp">  <p style="margin-bottom: 0"><i><font face="Verdana" size="4" color="#000080">  <b>Exclusão de Dados</b></font></i></p>  <hr color="#000080" width="30%" size="1" align="left">  <div align="center">    <center>  <table border="1" cellpadding="3" style="border-collapse: collapse" bordercolor="#FFFFFF" width="80%" id="AutoNumber1" height="50">    <tr>      <td width="100%" align="center" bgcolor="#000080" colspan="5" height="20">      <table border="0" cellpadding="3" style="border-collapse: collapse" bordercolor="#000000" width="100%" id="AutoNumber2" bgcolor="#FFFFFF" height="20">        <tr>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Janeiro">JAN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Fevereiro">FEV</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Março">MAR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Abril">ABR</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Maio">MAI</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Junho">JUN</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Julho">JUL</a></b></td>          <td width="8%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Agosto">AGO</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Setembro">SET</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Outubro">OUT</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Novembro">NOV</a></b></td>          <td width="9%" align="center" height="14" style="border-left-style: dotted; border-left-width: 1; border-right-style: dotted; border-right-width: 1"><b>          <a href="apagar.asp?mesinicio=Dezembro">DEZ</a></b></td>        </tr>      </table>      </td>    </tr>    <tr><% if not RS.EOF then %>      <td width="16%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">MES</font></b></td>      <td width="12%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">DIA</font></b></td>      <td width="9%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">HORA</font></b></td>      <td width="55%" align="center" bgcolor="#000080" height="22"><b><font color="#FFFFFF">PROGRAMAÇÃO</font></b></td>      <td width="8%" bgcolor="#000080" height="22">      <p align="center"><font color="#FFFFFF"><b>      <input type="submit" value=" EXCLUIR" name="Submit"></b></font></td>    </tr><%rs.Movefirstdo until rs.EOF%>    <tr>      <td width="16%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1"> <b><font size="2" color="#FF0000"><%=RS("mes")%></font></b></td>      <td width="12%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("dia")& " - "& RS("dia_s")%></td>      <td width="9%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <%=RS("hora")%></td>      <td width="55%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <p align="left">  <%=RS("programacao")%></td>      <td width="8%" align="center" style="border-style: dotted; border-width: 1" bordercolor="#000000" height="1">      <input type="checkbox" name="delete" value="<%=RS("ID")%>"></td>    </tr> <% RS.MoveNext  loop %>    <%else%><p><b><font face="Verdana" size="2">Desculpe, não existe programação para o mês:<font face="Verdana" size="2" color="red"> <%=mesinicio%>.</font></b></p><%end if%>  </table>    </center>  </div></form></font><!--#include file="menu.asp"--></body></html><%RS.CloseConn.Close%>

<{POST_SNAPBACK}>

 

 

 

 

 

 

 

 

 

 

 

eu nao vi onde você colocou

o codigo q determina a quantidade de registros a ser mostrado

tipo

 

rs.pagesize = 2 ' seria o recordset =rs e pagesize pra determinar a quantidade de pagina no caso 2 isso deve ficar antes do select se eu nao tiver enganado e isso

 

beleza

 

 

ate mais

<{POST_SNAPBACK}>

correçao =2 e o numero de registro por pagina e nao o numero de pagina

 

foi mal

Compartilhar este post


Link para o post
Compartilhar em outros sites

eu já resolvi o problema, vlw!

Errei alguma coisa na condição if, refiz tudo do zero eão deu mais erro!

as vezes só dá certo assim mesmo...

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.