Jump to content
Fórum Script Brasil
  • 0

Erro: Requested Operation Requires A Current Record


Guest Welder
 Share

Question

Guest Welder

Boa tarde

eu estou com um erro no busca.asp, quando eu coloco uma palavra que não exista no banco de dados apareçe esse erro:

ADODB.Recordset error '800a0bcd' 

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. 

/windows/busca.asp, line 151
line 151 seria:
148 - rs.Open SQL, Conexao, 3
149 -  rs.CacheSize = regs
150 -
151 -  rs.MoveFirst
152 -  rs.PageSize =regs
153 - 
154 -
155 -  rs.AbsolutePage = pag
156 - if rs.EOF then%>
busca.asp
<!--#include file="conectar.asp"-->
<html>
<head>
<title> "nome"</title>
<style>
input {
background-color: #0688B9;
font-family: Verdana;
font-size: 9pt;
color: #FFFFFF;
border: 1px solid #FFFFFF;
vertical-align: middle
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#73BCF2">
<font face="Verdana" size="2">
<font size="1">
<font color="#000000">
&lt;script language="JavaScript">
function abrejanela(sURL){
newwindow=open(sURL,"ver","scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=320,height=60");
}
//
</script>
<% AbreConexao
If Request.querystring("a") = "1" Then
s=request.querystring("s")
regs=5
pag=request.querystring("pagina")

If pag = "" then
pag = 1
End if

Sql = "SELECT * FROM download WHERE nome LIKE '%"&s&"%' OR descricao LIKE '%"&s&"%' "

Set rs = Createobject("ADODB.recordset")



rs.Open SQL, Conexao, 3
 rs.CacheSize = regs

  rs.MoveFirst
  rs.PageSize =regs


  rs.AbsolutePage = pag
if rs.EOF then%>
<font color="#FFFFFF" size="2">Nenhum arquivo encontrado, na busca pela palavra <b><%=s%></b></font>
<% else
contador = 0 %>
Foram encontrados <%=rs.recordcount%> arquivos, na busca pela palavra <b><%=s%></b><BR>
<BR>
</font><font face="Verdana" size="2"><font color="#000000"><font face="Verdana" size="2">
<% Do While Not rs.EOF AND contador < rs.Pagesize
nome=replace(rs("nome"), ""&s&"", "<font color=red><b>"&s&"</font></b>")
nome=replace(rs("nome"), ""&s&"", "<b><font color=red>"&s&"</b></font>")
contador = contador +1 %>
</font></font></font>
<div align="center">
  <table width="547" border="1" cellpadding="3" cellspacing="0" bordercolor="#2FFF2F" bordercolorlight="#FFFFFF">
    <tr bordercolor="#FFFFFF">
      <td height="20" colspan="3" background="img/x1.jpg"><font color="#000000" size="1" face="verdana"><a href="download.asp?id=<%=rs("id")%>"><%=rs("nome")%></a></font>
        <div align="center"></div>        <div align="center">
          <div align="left"><font size="1"><font face="verdana"><font face="verdana"><font face="verdana"><font face="verdana"></font></font></font></font></font></div>
        </div>
      </td>
    </tr>
    <tr>
      <td height="116" colspan="3" bgcolor="#FFFFFF"><table width="100%" height="108">
          <tr bordercolor="#CCCCCC">
            <td width="21%" height="102"><div align="center"><font color="#000000"><img src="<%=rs("foto") %>" width="95" height="95" border="0"></font></div>
            </td>
            <td width="79%"><p><font color="#000000" size="1" face="verdana"><%=rs("descricao")%></font> </p>
                <p> </p>
                <p> </p>
                <div align="center"> </div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><font color="#000000" size="1" face="verdana">Tamanho: <%=rs("tamanho")%></font></td>
      <td colspan="2" bgcolor="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#000000" size="1" face="verdana">Licença: <%=rs("licenca")%> </font><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif"><font size="1" face="verdana">    </font></font></font></font></font></font></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><font color="#000000" size="1" face="verdana">Adicionado
          em: <%=rs("adicionado")%></font></td>
      <td colspan="2" bgcolor="#FFFFFF"><font color="#000000" size="1" face="verdana">Sistema</font><font color="#000000" size="1" face="verdana">: <%=rs("idioma")%></font><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"></font></font></font></font></td>
    </tr>
    <tr>
      <td width="251" height="26" background="img/x2.jpg" bgcolor="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"> </font></font></font></font><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#A8E6FD" size="1"><font size="1" color="#FFFFFF"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif"><font size="1" face="verdana">Média
                    de votos: <%=rs("media")%> <a href="java script:abrejanela('voto.asp?id=<%=rs("id")%>')">Avaliar</a></font></font></font></font></font></font></td>
      <td colspan="2" background="img/x2.jpg" bgcolor="#FFFFFF">
        <div align="left">
          <div align="left"><font size="1" face="verdana"><font color="#000000">Cliques: </font></font><font color="#A8E6FD" size="1" face="verdana"><%=rs("cliques")%></font></div>
        </div>
      </td>
    </tr>
  </table>
  <font color="#000000"><font color="#000000" size="1" face="verdana"><BR>
  <% rs.MoveNext
Loop %>

  <br>
  <font size="1" face="Verdana">Página(s):
  <% For i = 1 To rs.PageCount
If i = cint(pag) Then
Response.Write i
Else
pagina=request.querystring("pagina")
Response.Write "<a href='" & request.servervariables("script_name") & "?s="&s&"&a="&request.querystring("a")&"&pagina=" & i & "'>" & i & "</a> "
End If

Next

End if %>
</font></font></div>
</font>
<form method="GET" action="busca.asp">
  <div align="right"><font color="#000000" size="2" face="Verdana">    <div align="center">
      <input type="hidden" name="a" value="1">
      <font face="Verdana" size="2"><font face="verdana"><font color="#000000"><font size="1"><font face="verdana" size="2"><font size="1" color="#000000"><font color="#000000" size="2" face="Verdana">
      </font><font face="Verdana" size="2"><font face="verdana">
      <input type="text" name="s" size="15" value="Buscar por" style="color: #000000; border: 1px solid #008000; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF">
      <font face="verdana" size="2"><font size="1" color="#000000"><font color="#000000" size="2" face="Verdana">
      <input name="submit2" type="submit" style="color: #000000; border: 1px solid #000000; background-color: #FFFFFF" value="Pesquisar">
      </font></font><font size="2"> </font></font><font face="verdana" size="2"><font size="1" color="#000000"><font color="#000000" size="2" face="Verdana"></font></font></font></font></font></font></font></font></font></font></font></div>
  </font></div>
</form>
<font face="Verdana" size="2"><font color="#000000" size="1" face="verdana">
<% Else %>
</font><font face="verdana"><form method="GET" action="busca.asp">
<font face="verdana">
<input type="hidden" name="a" value="1">
</font>
<input type="text" name="s" size="25" value="Buscar por" style="color: #000000; border: 1px solid #008000; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #FFFFFF">
<font face="verdana" size="2"><font size="1" color="#000000"><font color="#000000" size="2" face="Verdana">
<input type="submit" value="Pesquisar" style="color: #000000; border: 1px solid #000000; background-color: #FFFFFF">
</font></font><font size="2">
  </font></font><font face="verdana" size="2"><font size="1" color="#000000"><font color="#000000" size="2" face="Verdana"></font>
   </font></font>
</form>
<font color="#000000" size="1" face="verdana">
<% End If %>

aguardo respostas.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Guest welder

ond eu coloco esse codigo ?

<% if af.eof then 

response.write "A busca retornou sem resultados"

else

while not af.eof
response.write af("rgi")
af.movenext
wend

end if
%>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.1k
    • Total Posts
      647k
×
×
  • Create New...