Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Oi pessoal, estou aprendendo ASP e tenho um código que peguei da net que não tá funcionando. Será que vcs podem ajudar-me??? Obrigada.
Erro:
ADODB.Recordset erro '800a0e78'
Operação não permitida quando o objeto está fechado.
/resultados.asp, line 44
Código:
43) exe.PageSize = intPageSize
44) If Not(exe.EOF) Then exe.AbsolutePage = intCurrentPage
Código Completo:
<%@ LANGUAGE="VBSCRIPT"%><!--#include file="includes/config.asp"--><!--#include file="includes/abrebanco.asp"--><!--#include file="includes/adovbs.inc"--><%var_categoria = Request.form("f_categoria") 'variável "var_categoria" recebe o valor por meio de um controle (método post) que o usuário digitou no "f_categoria" var_tipo = Request.form("f_tipo")var_local = Request.form("f_local")var_valor = Request.Form("f_valor")Response.Expires = 0 'toda pesquisa deverá ser efetuada no servidor e não no buffer"Const intPageSize = 20 If Request.Querystring = "" then 'se o valor da variavel (metodo get) for igual a vazio, então intCurrentPage = 1 'exiba uma linha Else 'senão intCurrentPage = CInt(Request.Querystring("CurrentPage")) ' Select Case Request.Querystring("Submit") Case "Previous" 'caso Anterior intCurrentPage = intCurrentPage -1'volte uma página Case "Next" 'caso Próxima intCurrentPage = intCurrentPage +1 'avance uma página End Select 'fim selectEnd If 'fim seSet exe = Server.CreateObject("ADODB.Recordset")exe.CursorLocation = adUseClientexe.CursorType = adOpenStaticexe.CacheSize = intPageSizeIf var_valor = "Informe o valor" Then var_valor = "> 0"End Ifsql_categ = "SELECT DISTINCT categoria FROM imoveis"sql_tipo = "SELECT DISTINCT tipo FROM imoveis"sql_local = "SELECT DISTINCT bairro FROM imoveis"Set exe_categ = banco.execute(sql_categ)Set exe_tipo = banco.execute(sql_tipo)Set exe_local = banco.execute(sql_local)exe.PageSize = intPageSizeIf Not(exe.EOF) Then exe.AbsolutePage = intCurrentPageintTotalPages = exe.PageCount%><title><%=titulo%></title><body background="fundo.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><link href="<%=local%>includes/styles/link.css" rel="stylesheet" type="text/css"><table width="765" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="765" height="140" VIEWASTEXT> <param name="movie" value="topo.swf"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <embed src="topo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="765" height="140"></embed></object></td> </tr> <tr> <td><table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="53" height="284" valign="top"> </td> <td width="637" height="0" valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="0"> </td> </tr> <tr> <td height="0"><%=fonte02%><strong>Resultado da busca</strong></td> </tr> <tr> <td height="0"> </td> </tr> <tr> <td height="0"><div align="center"><%=fonte02%> <% If var_categoria = "Informe a categoria" Then Response.Write "Informe a categoria" Elseif var_tipo = "Informe o tipo" Then Response.Write "Informe o tipo" Elseif var_local = "Informe o bairro" Then Response.Write "Informe o bairro" Else %> </div></td> </tr> <tr> <td height="0"> <% If exe.EOF then Response.Write fonte02 & "<center>Não foi encontrado nenhum imóvel com essas especificações.</center>" Else %> <div align="center"></div> <table width="100%" cellpadding="0" cellspacing="1" bgcolor="<%=table_color%>"> <tr> <td width="60" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Cód.</div></td> <td width="122" height="20" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Local</div></td> <td width="55" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Área</div></td> <td width="60" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Dorm.</div></td> <td width="53" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Suítes</div></td> <td width="56" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Foto</div></td> <td width="62" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Tipo</div></td> <td width="109" bgcolor="<%=tit_fundo%>"><%=fonte03%> <div align="center">Preço(R$)</div></td> <td width="35" bgcolor="<%=tit_fundo%>"><div align="center"></div></td> </tr> <%For intI = 1 to exe.PageSize%> <%IF linha THEN%> <tr bgcolor="<%=td_color01%>"> <%ELSE%> <tr bgcolor="<%=td_color02%>"> <%END IF : linha = not linha%> <td width="60"><div align="center"><%=fonte01%><%=exe("id")%></div></td> <td><div align="left"></div> <%=fonte01%><%=exe("bairro")%></td> <td><div align="center"><%=fonte01%><%=exe("area")%></div></td> <td><div align="center"><%=fonte01%><%=exe("dormitorio")%></div></td> <td><div align="center"><%=fonte01%><%=exe("suite")%></div></td> <td width="56"><div align="center"> <%If exe("foto1") = "" Then Response.Write foto_nao Else Response.Write foto_sim End If%> </div></td> <td><div align="center"><%=fonte01%><%=exe("tipo")%></div></td> <td><div align="left"></div> <%=fonte01%><%=FormatCurrency(exe("preco"))%></td> <td width="35"><div align="center"><a href="mais.asp?categoria=<%=exe("categoria")%>&id=<%=exe("id")%>"><strong><%=fonte01%>mais</strong></a></div></td> </tr> <%exe.movenext If exe.EOF Then Exit For Next%> <tr> <td height="20" colspan="9" bgcolor="<%=tit_fundo%>"><div align="right"> <%response.write fonte04&"Página: "for i = 1 to exe.pagecountif i = cint(intCurrentPage) then response.write i & " "else response.write "<a href='" & request.servervariables("script_name") & "?currentpage=" & i & "'>" & i & "</a> "end ifnext%> </div></td> </tr> </table> <%End ifEnd If%> </td> </tr> <tr> <td height="0"> </td> </tr> <tr> <td height="0"><div align="center"></div></td> </tr> <tr> <td height="0"><div align="center"><%=fonte01%><a href="javascript:window.history.go(-1)">Voltar</a> - <a href="<%=local%>">Retornar a pág</a><a href="<%=local%>">ina principal</a> </div></td> </tr> <tr> <td height="0"> </td> </tr> </table></td> <td width="60" valign="top"><div id="Layer2" style="position:absolute; left:707px; top:0px; width:188px; height:127px; z-index:52"> <form action="resultados.asp" method="post"> <table width="165" height="110" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="0072b8"> <tr> <td height="25" align="center" valign="middle"><font color="0072b8"><img src="imagens/index/banner/busca.jpg" width="137" height="22"></font></td> </tr> <tr> <td height="25" align="center" valign="middle"> <div align="center"> <select name="f_categoria" size="1" class="formindex"> <option selected>Informe a categoria</option> <% WHILE NOT exe_categ.eof Response.Write "<option>"& exe_categ("categoria") &"</option>" exe_categ.MOVENEXT WEND %> </select> </div></td> </tr> <tr> <td height="25" align="center" valign="middle"> <div align="center"> <select name="f_tipo" size="1" class="formindex"> <option selected>Informe o tipo</option> <% WHILE NOT exe_tipo.eof Response.Write "<option>"& exe_tipo("tipo") &"</option>" exe_tipo.MOVENEXT WEND %> </select> </div></td> </tr> <tr> <td height="25" align="center" valign="middle"> <div align="center"> <select name="f_local" size="1" class="formindex"> <option selected>Informe o local</option> <% WHILE NOT exe_local.eof Response.Write "<option>"& exe_local("bairro") &"</option>" exe_local.MOVENEXT WEND %> </select> </div></td> </tr> <tr> <td height="20"> <div align="center"> <input name="imageField" type="image" src="imagens/index/banner/buscar.jpg" width="76" height="18" border="0"> </div></td> </tr> </table> </form> </div></td> </tr> </table></td> </tr> <tr> <td valign="top"><img src="imagens/index/rodape.jpg" width="765" height="17" align="top"></td> </tr></table></body><!--#include file="includes/fechabanco.asp"-->
Carregando comentários...