Foros del Web » Programando para Internet » ASP Clásico »

Error al mostrar los datos de una BD

Estas en el tema de Error al mostrar los datos de una BD en el foro de ASP Clásico en Foros del Web. Ante todo gracias, soy nuevo tanto en el foro como en la programacion con asp. El problema me viene al mostrar los datos que tengo ...
  #1 (permalink)  
Antiguo 21/09/2004, 08:41
Avatar de liebre  
Fecha de Ingreso: septiembre-2004
Ubicación: Gavilanes
Mensajes: 17
Antigüedad: 19 años, 8 meses
Puntos: 0
Exclamación Error al mostrar los datos de una BD

Ante todo gracias, soy nuevo tanto en el foro como en la programacion con asp.
El problema me viene al mostrar los datos que tengo guardados en una base de datos access, cuando envio un registro nuevo o lo intento mostrar sin añadir un registro me da este error:
Tipo de error:
ADODB.Field (0x80020009)
El valor de BOF o EOF es True, o el actual registro se eliminó; la operación solicitada requiere un registro actual.
/mario/anuncio/anuncio.asp


Pero si reenvio la información me muestra los datos duplicados, he intentado todo, hasta rehacerlo desde el principio pero me sigue sin salir.
El error viene desde que hice una página que borraba un registro selecionado.
Si alguien puede ayudarme se lo agradecería mucho.
Gracias.
  #2 (permalink)  
Antiguo 21/09/2004, 08:47
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
para poder ayudarte mejor, pon el codigo
saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
  #3 (permalink)  
Antiguo 21/09/2004, 08:54
 
Fecha de Ingreso: septiembre-2003
Mensajes: 265
Antigüedad: 20 años, 8 meses
Puntos: 1
si muestra el codigo, yo tambien e tenido el mismo problema pero lo e resuelto, pero para ser mas facil pon el codigp
  #4 (permalink)  
Antiguo 21/09/2004, 09:18
Avatar de liebre  
Fecha de Ingreso: septiembre-2004
Ubicación: Gavilanes
Mensajes: 17
Antigüedad: 19 años, 8 meses
Puntos: 0
ya teneis el codigo

He puesto todo el codigo espero que lo entedais, soy primerizo si engo errores tontos pido perdon
Gracias .

<html>
<!--#include file="./adovbs.inc"-->
<head>
<title>Tablon de Anuncios</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="108%" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="100%">
<h1 align="center"><font color="#FF0000" size="7"><strong><u>Tabl&oacute;n de
Anuncios</u></strong></font></h1>
</td>
</tr>
<tr>
<td width="100%"> </a> </td>
</tr>
<tr>
<td width="100%"> <p align="center"> <BR>
<%
Dim conexion
%>
<!--#include File="conectabd2.asp"-->
<%
conexion= Session("DbGeneral")

Dim sqltxt
Dim conn
Dim rst
Dim contador
sqltxt = "select * from anuncio;"
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open conexion
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open sqltxt, conn, adOpenStatic,adLockReadOnly,adCmdText
contador=rst.PageCount
If Contador = 0 Then
Response.Write "¡ No hay articulos que mostrar !"
Else

Do While Not( rst.EOF and rst.BOF)
%>
<table width="800" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td width="600" rowspan="2"><font face="Verdana" size="2
"><b><font color="#0000FF"><%=rst("titulo")%></font></b></font></td>
<td width="110">
<div align="right"><font color="#FF0000"><strong>Fecha:</strong></font></div></td>
<td width="90">
<div align="right"><font color="#FF0000"><strong> </strong></font><font face="Verdana" size="2"><b><font color="#336699"><%=rst("fecha")%></font></b></font></div></td>
</tr>
<tr>
<td width="110">
<div align="right"><font color="#FF0000"><strong>N&ordf; Anuncio:</strong></font><font face="Verdana" size="2"><b></b></font></div></td>
<td width="90">
<div align="right"><font face="Verdana" size="2"><b><font color="#336699"><%=rst("id")%></font></b></font></div></td>
</tr>
</table>
<p>&nbsp;</p>
<p>
<% if rst("foto1")="0" and rst("foto2")="0" and rst("foto3")="0" then%>
</p>
<table width="800" height="" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="justify"><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><%=rst("anuncio")%></font></b></font></div></td>
</tr>
</table>

<% else %>
<table width="800" height="96" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="380" rowspan="3" align="left" valign="top"><div align="justify"><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><%=rst("anuncio")%></font></b></font></div></td>
<td width="40" height="64">&nbsp;</td>
<% if rst("foto1")<>"0" then %>
<td width="380"><p><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><img src="../fotos/fotos/<%=rst("foto1")%>" width="380" align="absmiddle"></font></p>
<p>&nbsp;</p></td>
<% end if %>
</tr>
<tr>
<td height="64">&nbsp;</td>
<% if rst("foto2")<>"0" then %>

<td><p><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699">
</font><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><img src="../fotos/fotos/<%=rst("foto2")%>" width="380" align="right"></font></b></font><font color="#336699"></font></b></font>
<p>&nbsp;</p>
</td>
<% end if %>
</tr>
<tr>
<td height="64">&nbsp;</td>
<% if rst("foto3")<>"0" then %>

<td width="380"><p>&nbsp;</p>
<p><img src="../fotos/fotos/<%=rst("foto3")%>" width="380"></p></td>
<% end if%>
</tr>
<% end if %>
</table>

<p>&nbsp;</p><p>&nbsp;</p><hr>



<p>
<%
rst.movenext
%>
<table width="800" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td width="600" rowspan="2"><font face="Verdana" size="2
"><b><font color="#0000FF"><%=rst("titulo")%></font></b></font></td>
<td width="110">
<div align="right"><font color="#FF0000"><strong>Fecha:</strong></font><font face="Verdana" size="2"><b></b></font></div></td>
<td width="90">
<div align="right"><font face="Verdana" size="2"><b><font color="#336699"><%=rst("fecha")%></font></b></font></div></td>
</tr>
<tr>
<td width="110">
<div align="right"><font color="#FF0000"><strong>N&ordm; Anuncio:</strong></font><font face="Verdana" size="2"><b></b></font></div></td>
<td width="90">
<div align="right"><font face="Verdana" size="2"><b><font color="#336699"><%=rst("id")%></font></b></font></div></td>
</tr>
</table>
<p>&nbsp;</p>
<p>
<% if rst("foto1")="0" and rst("foto2")="0" and rst("foto3")="0" then%>
<font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b></b></font>
</p>
<table width="800" height="" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="justify"><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><%=rst("anuncio")%></font></b></font></div></td>
</tr>
</table>

<% else %>
<table width="800" height="96" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<% if rst("foto1")<>"0" then %>
<td width="380" align="left" valign="top"><p><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><img src="../fotos/fotos/<%=rst("foto1")%>" width="380" align="absmiddle"></font></p>
<p>&nbsp;</p></td>
<% end if %>
<td width="40" height="64">&nbsp;</td>
<td width="380" rowspan="3" align="left" valign="top"></font> <div align="justify"><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><%=rst("anuncio")%></font></b></font></div></td>
</tr>
<tr>
<% if rst("foto2")<>"0" then %>
<td width="380" align="left" valign="top"><div align="left">
<p><font face="Verdana, Helvetica, sans-serif, Arial" size="2"><b><font color="#336699"><img src="../fotos/fotos/<%=rst("foto2")%>" width="380" align="right"></font></b></font></p>
</div><p>&nbsp;</p>
</td>
<% end if %>
<td height="64">&nbsp;</td>
</tr>
<tr>
<% if rst("foto3")<>"0" then %>
<td width="380" align="left" valign="top"><p>&nbsp;</p>
<p><img src="../fotos/fotos/<%=rst("foto3")%>" width="380"></p></td>
<% end if%>
<td height="64">&nbsp;</td>
</tr>
<% end if %>
</table>

<hr>

<%
rst.movenext
Loop
%>
<%
End If


rst.Close
Set rst = Nothing
Conn.Close
Set Conn = Nothing
%>
</p>
<p align="center">&nbsp; </tr>
</table>
<p align="center"><a href="./insertanuncio.asp"><font color="#FF0000"><strong>A&ntilde;adir
otro anuncio</strong></font></a></p>
<p align="center"><a href="../default.asp"><img src="../imagenes/flechaback.gif" width="21" height="22" border="0"></a></p>

</body>
</html>
  #5 (permalink)  
Antiguo 21/09/2004, 09:23
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
tratas de desplegar tres filas y dos columnas con distintos registros???
de ser asi hay una forma mas facil

me avisas
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
  #6 (permalink)  
Antiguo 21/09/2004, 09:33
Avatar de liebre  
Fecha de Ingreso: septiembre-2004
Ubicación: Gavilanes
Mensajes: 17
Antigüedad: 19 años, 8 meses
Puntos: 0
son tres filas y tres columnas, el la columna de la izquierda va el texto de un anuncio, en la del centro es un espacio de 40 pixel para separar y en la de la derecha van tres fotos.
las fotos se pueden poner o no
en la siguiente tabla va lo mismo pero las fotos en la columna de la izquierda, para que no sea mas facil a la hora de verlo.
  #7 (permalink)  
Antiguo 21/09/2004, 09:38
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
lo que pasa es que debes validar cuando haces el rs.movenext si es fin de archivo..... el primero
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
  #8 (permalink)  
Antiguo 21/09/2004, 09:55
Avatar de liebre  
Fecha de Ingreso: septiembre-2004
Ubicación: Gavilanes
Mensajes: 17
Antigüedad: 19 años, 8 meses
Puntos: 0
gracias llevo tres dias en esto y por fin sale. gracias de nuevo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:33.