Jump to content


Photo

Erro No Record Set


  • Faça o login para participar
1 reply to this topic

#1 Dehu

Dehu

    Novato no fórum

  • Usuários
  • 12 posts
  • Sexo:Não informado

Posted 08/02/2007, 10:02

Tenho em minha tabela:

ID
REGIAO
CATEGORIA
EMPRESA
TRABALHO
AGENCIA

No total existem 4 regiões e 14 categorias.
Então, quero exibir os dados e fiz o seguinte:
(INICIEI APENAS COM DUAS CATEGORIAS E UMA REGIÃO, DEPOIS VOU FAZER DAS 14 CATEGORIAS O CÓDIGO)

<!-- Início dos códigos Categoria: Campanha de Comunicação de Marketing-->

<%
set Conexao1=server.createobject("ADODB.connection")
Set RS1 = Server.CreateObject("ADODB.RecordSet")
Conexao1.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("dados/db/bd_premio2007.mdb")
SQL1 = "SELECT * FROM premio2007 WHERE categoria = 'Campanha de Comunicação de Marketing' AND regiao='"&regiao&"' ORDER BY empresa ASC"
RS1.open SQL1, Conexao1, 0, 1
%>

<table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr bgcolor="#CC3300"> 
	<td height="25" colspan="3"><div align="center"><%=rs1("categoria")%></div></td>
  </tr>  
	 
	   <% While Not RS1.EOF %>
	  
  <tr> 
	<td width="33%"><%=rs1("empresa")%></td>
	<td width="33%"><%=rs1("trabalho")%></td>
	<td width="33%"><%=rs1("agencia")%></td>
  </tr>
	  
	  <% RS1.MoveNext 
	  Wend %>

	<%
	RS1.Close
	Set RS1 = Nothing
	Conexao1.Close
	Set Conexao1 = Nothing
	%>
</table>
<br>
<hr size="1">
<br>

<!-- Início dos códigos Categoria: Comunicação Integrada-->

<%
set Conexao2=server.createobject("ADODB.connection")
Set RS2 = Server.CreateObject("ADODB.RecordSet")
Conexao2.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("dados/db/bd_premio2007.mdb")
SQL2 = "SELECT * FROM premio2007 WHERE categoria = 'Comunicação Integrada' AND regiao='"&regiao&"' ORDER BY empresa ASC"
RS2.open SQL2, Conexao2, 0, 1
%>

<table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr bgcolor="#CC3300"> 
	<td height="25" colspan="3"><div align="center"><%=rs2("categoria")%></div></td>
  </tr>  
	 
	   <% While Not RS.EOF %>
	  
  <tr> 
	<td width="33%"><%=rs2("empresa")%></td>
	<td width="33%"><%=rs2("trabalho")%></td>
	<td width="33%"><%=rs2("agencia")%></td>
  </tr>
	  
	  <% RS2.MoveNext 
	  Wend %>

	<%
	RS22.Close
	Set RS = Nothing
	Conexao2.Close
	Set Conexao2 = Nothing
	%>
</table>
<br>
<hr size="1">
<br>


O seguinte erro está sendo apresentado:

Microsoft VBScript runtime error '800a01a8'
Object required: ''

/novo/premio2007/lista.asp, line 65




O que estou errando?

Edição feita por: Dehu, 08/02/2007, 10:54.


#2 siola

siola

    Usuário

  • Usuários
  • 894 posts
  • Sexo:Masculino
  • Localidade:SBC - SP
  • Interesses:ASP, .NET, javascript

Posted 11/02/2007, 12:37

<% While Not RS.EOF %>

mude para

<% While Not RS2.EOF %>

¬¬




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq