Ir para conteúdo

POWERED BY:

Arquivado

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

PhoEniXFirE

Quando Tá Sem Dados No Banco De Dados Some O Resto

Recommended Posts

       <table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4"><% Set Conn = Server.CreateObject("AdoDb.Connection") Conn.provider="Microsoft.Jet.OLEDB.4.0" Conn.connectionstring=Server.Mappath("database.mdb") Conn.open Set RS = Server.CreateObject("adodb.recordset")RS.PageSize = 10SQL = "select * from rosa" RS.Open SQL,Conn,3,3%>          <tr>            <td width="4" background="table_bg.gif" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF" bgcolor="#6595D6">            <span style="font-weight: 700">            <font face="Arial" style="font-size: 9pt" color="#FFFFFF"> </font></span></td>            <td width="200%" background="table_bg.gif" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF" bgcolor="#6595D6">            <font color="#FFFFFF" face="Arial" style="font-size: 9pt; font-weight: 700">            Perguntas enviadas </font>            <font color="#FFFFFF" face="Arial" style="font-size: 9pt; ">            (<% Response.Write rs.RecordCount %>)</font><font color="#FFFFFF" face="Arial" style="font-size: 9pt; font-weight: 700">:</font></td>          </tr><%IF RS.EOF then %>          <tr>            <td width="4" bgcolor="#F8F8FC" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF"> </td>            <td width="100%" bgcolor="#F8F8FC" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">            <font face="Arial" style="font-size: 8pt;" color="#21303F">Nenhum pergunta foi encontrada.     <font size=1><br>Caso queria enviar uma pergunta, clique no botão <Envie uma pergunta>.</font></font></td>          </tr><%   Response.EndELSE   IF Request.QueryString("pagina")="" then       intpagina=1    ELSE      IF cint(Request.QueryString("pagina"))<1 then         intpagina=1       ELSE         IF cint(Request.QueryString("pagina"))> RS.PageCount then             intpagina=RS.PageCount          ELSE            intpagina=Request.QueryString("pagina")         END IF      END IF   END IFEND IFRS.AbsolutePage=intpaginaintrec=0While intrec < RS.PageSize and not RS.EOF %>          <tr>            <td width="4" bgcolor="#E6E7F2" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">            <font face="Arial" style="font-size: 9pt; font-weight: 700" color="#465584"> </font></td>            <td width="100%" bgcolor="#E6E7F2" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">            <b>            <font face="Arial" style="font-size: 9pt" color="#465584">1.             <% response.write RS("pergunta") %><br>            </font>            <font face="Arial" color="#465584" size="1">por             <a href="mailto:<% response.write RS("email") %>" title="Idade: <% response.write RS("idade") %> / Ocupação: <% response.write RS("ocupacao") %>">            <font color="#465584"><% response.write RS("nome") %></font></a> (<% response.write RS("cidade") %>)</font></b></td>          </tr>          <tr>            <td width="4" bgcolor="#F8F8FC" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF"> </td>            <td width="100%" bgcolor="#F8F8FC" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">            <font face="Arial" style="font-size: 8pt; font-weight:700" color="#21303F"><% response.write RS("resposta") %></font></td>          </tr><% RS.MoveNext   intrec=intrec+1   IF RS.EOF then       response.write " "    END IFWend %>  </table>    <tr>    <td width="100%"> </td>  </tr>  <tr>    <td width="100%"><center><font face="Arial" size="1"><% IF intpagina > 1 then %> <a href="./?pagina=<%=intpagina-1%>"><font color="#21303F">[anterior]</font></a><% END IF %><font color="#465584">[<%=intpagina%>]</font><% IF strcomp(intpagina,RS.PageCount) <> 0 then %> <a href="./?pagina=<%=intpagina+1%>"><font color="#21303F">[seguinte]</font></a></font><% END IF %></center></font></td>  </tr></table></center></div>

Este eh o arquivo.

 

Quando tem dados no db funciona tudo perfeito, mas qndo o database ta zerado então a partir da msg q avisa q o db está vazio não aparece o restante da página.

 

Este script n eh meu, por isso n estou conseguindo resolver este problema, mas sei q tem uma galera aqui q sabe resolver esses detallhezinho.

 

Quem puder me ajude !!

 

ValewS!!!!!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

isso é o Response.Endque faz...

Compartilhar este post


Link para o post
Compartilhar em outros sites

eu tb imaginei q fosse isso, mas qndo eu tiro esta linha da o seguinte erro: ADODB.Recordset (0x800A0BB9) Os argumentos são incorretos, estão fora do intervalo aceitável ou estão em conflito. /forumeuclidense/rosa/default.asp, line 129

Compartilhar este post


Link para o post
Compartilhar em outros sites

cara mas normalmente quando se usa isso é pra não carregar o resto da page mesmo quem fez, acho que não foi você, fez pensando assimbem se você quer alterar pra tirar isso e não dá erro o podo do forum de ASP pode te ajudarcomeçe dizendo que linha é essa do erroprovavelmente você deverá usar alguma outra estrutura condicional...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Muda a posição do end if pra depois de todo o código

 

ASP [/tr][tr] <table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">

<%

 

Set Conn = Server.CreateObject("AdoDb.Connection")

Conn.provider="Microsoft.Jet.OLEDB.4.0"

Conn.connectionstring=Server.Mappath("database.mdb")

Conn.open

 

Set RS = Server.CreateObject("adodb.recordset")

RS.PageSize = 10

 

SQL = "select * from rosa"

RS.Open SQL,Conn,3,3

 

%> <tr>

<td width="4" background="table_bg.gif" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF" bgcolor="#6595D6">

<span style="font-weight: 700">

<font face="Arial" style="font-size: 9pt" color="#FFFFFF"> </font></span></td>

<td width="200%" background="table_bg.gif" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF" bgcolor="#6595D6">

<font color="#FFFFFF" face="Arial" style="font-size: 9pt; font-weight: 700">

Perguntas enviadas </font>

<font color="#FFFFFF" face="Arial" style="font-size: 9pt; ">

(<% Response.Write rs.RecordCount %>)</font><font color="#FFFFFF" face="Arial" style="font-size: 9pt; font-weight: 700">:</font></td>

</tr>

<%

IF RS.EOF then %>

<tr>

<td width="4" bgcolor="#F8F8FC" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF"> </td>

<td width="100%" bgcolor="#F8F8FC" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">

<font face="Arial" style="font-size: 8pt;" color="#21303F">Nenhum pergunta foi encontrada.

<font size=1><br>Caso queria enviar uma pergunta, clique no botão <Envie uma pergunta>.</font></font></td>

</tr>

<% Response.End

ELSE

IF Request.QueryString("pagina")="" then

intpagina=1

ELSE

IF cint(Request.QueryString("pagina"))<1 then

intpagina=1

ELSE

IF cint(Request.QueryString("pagina"))> RS.PageCount then

intpagina=RS.PageCount

ELSE

intpagina=Request.QueryString("pagina")

END IF

END IF

END IF

 

RS.AbsolutePage=intpagina

 

intrec=0

 

While intrec < RS.PageSize and not RS.EOF %>

<tr>

<td width="4" bgcolor="#E6E7F2" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">

<font face="Arial" style="font-size: 9pt; font-weight: 700" color="#465584"> </font></td>

<td width="100%" bgcolor="#E6E7F2" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">

<b>

<font face="Arial" style="font-size: 9pt" color="#465584">1.

<% response.write RS("pergunta") %><br>

</font>

<font face="Arial" color="#465584" size="1">por

<a href="mailto:<% response.write RS("email") %>" title="Idade: <% response.write RS("idade") %> / Ocupação: <% response.write RS("ocupacao") %>">

<font color="#465584"><% response.write RS("nome") %></font></a> (<% response.write RS("cidade") %>)</font></b></td>

</tr>

<tr>

<td width="4" bgcolor="#F8F8FC" style="border-left: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF"> </td>

<td width="100%" bgcolor="#F8F8FC" style="border-right: 1px solid #FFFFFF; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF">

<font face="Arial" style="font-size: 8pt; font-weight:700" color="#21303F"><% response.write RS("resposta") %></font></td>

</tr>

<%

RS.MoveNext

 

intrec=intrec+1

 

IF RS.EOF then

response.write " "

END IF

Wend %> </table>

<tr>

<td width="100%">

 </td>

</tr>

<tr>

<td width="100%">

<center><font face="Arial" size="1">

 

<% IF intpagina > 1 then %>

<a href="./?pagina=<%=intpagina-1%>"><font color="#21303F">[anterior]</font></a>

<% END IF %>

 

<font color="#465584">[<%=intpagina%>]</font>

 

<% IF strcomp(intpagina,RS.PageCount) <> 0 then %>

<a href="./?pagina=<%=intpagina+1%>"><font color="#21303F">[seguinte]</font></a></font>

<% END IF %>

<%END IF%>

</center></font></td>

</tr>

</table></center>

</div>

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites

cara mas normalmente quando se usa isso é pra não carregar o resto da page mesmo quem fez, acho que não foi você, fez pensando assim...

A linha eh esta:
RS.AbsolutePage=intpagina

Compartilhar este post


Link para o post
Compartilhar em outros sites

esta linha vai ser usada na paginaçãodeve receber um valor numerico maior que zero obrigatoriamenteverifica issoou então poe ela dentro do if dos dados existentes

Compartilhar este post


Link para o post
Compartilhar em outros sites

Muda a posição do end if pra depois de todo o código....

Boa cara, fiz a modificação do End If e realmente deu certo, apenas tive q reorganizar as tabelas. Mas agora está beleza.Obrigado!!

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.