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

Error en paginación

Estas en el tema de Error en paginación en el foro de ASP Clásico en Foros del Web. Hola! Tengo este script: <% Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ= " & Server.MapPath("DB/INDEX.mdb") %> <% ssql = " Select ...
  #1 (permalink)  
Antiguo 23/01/2008, 11:54
Avatar de JJF
JJF
 
Fecha de Ingreso: mayo-2005
Mensajes: 205
Antigüedad: 19 años
Puntos: 0
Sonrisa Error en paginación

Hola! Tengo este script:

<%
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ= " & Server.MapPath("DB/INDEX.mdb")
%>
<%
ssql = " Select * from BLOG where ID1 = " & Request.QueryString("ID1") & " order by FH desc"

Set RS=Conn.Execute(ssql)

ssql = " Select * from login "

Set RS3=Conn.Execute(ssql)

%>




ta ta ta ta


y para paginar lo siguiente:

<% While ((Repeat1__numRows <> 0) AND (NOT RS.EOF))%>
<tr>
<td width="12%" height="54">
<img border="0" src="images/<%=RS("ICON")%>.jpg" width="53" height="52" ALT onerror="src='images/icon.gif';"width="0" height="0" align="left"></td>
<td width="88%" height="54" valign="top" bgcolor="#C7DAF8"><font size="2"><%=RS("frase")%></font></td>
</tr>




<tr>
<td colspan="2"><font size="2"><br><%=RS("msn")%></font></td>
</tr>
<tr>
<td colspan="2"><!--#include virtual="img.asp" --></td>
</tr>
<tr>
<td colspan="2"><b><font size="1" color="#FFFFFF"><%=rs("titft1")%></font></b></td>
</tr>
<tr>
<td colspan="2"><!--#include virtual="vd.asp" --></td>
</tr>


<tr>
<td colspan="2"><%=rs("fh")%></td>
</tr>
<tr>
<td colspan="2"><hr color="#FF9900" size="1" width="400">&nbsp;</td>
</tr>

<%Repeat1__index = Repeat1__index + 1
Repeat1__numRows = Repeat1__numRows - 1
RS.MoveNext
Wend%>


Cuando la cantidad de registro es igual a "0" me da un error 500 porque no sé qué agregarle para que me diga que no hay registros.

Muchas gracias.
  #2 (permalink)  
Antiguo 24/01/2008, 13:13
Avatar de Potro  
Fecha de Ingreso: abril-2001
Mensajes: 2.249
Antigüedad: 23 años, 1 mes
Puntos: 39
Re: Error en paginación

Eso lo resuelves haciendo una consulta previa..
***********************************

ssql2 = " Select count(*) as cuantos from login "

Set RS4=Conn.Execute(ssql2)

cuantos = RS4("cuantos")

If cuantos = 0 then
Response.Write("<br><center>No se encontraron resultados.</center>")
else
%>


y despues tu codigo si hay registros..
*************


<% While ((Repeat1__numRows <> 0) AND (NOT RS.EOF))%>
<tr>
<td width="12%" height="54">
<img border="0" src="http://www.forosdelweb.com/images/<%=RS("ICON")%>.jpg" width="53" height="52" ALT onerror="src='images/icon.gif';"width="0" height="0" align="left"></td>
<td width="88%" height="54" valign="top" bgcolor="#C7DAF8"><font size="2"><%=RS("frase")%></font></td>
</tr>




<tr>
<td colspan="2"><font size="2"><br><%=RS("msn")%></font></td>
</tr>
<tr>
<td colspan="2"><!--#include virtual="img.asp" --></td>
</tr>
<tr>
<td colspan="2"><b><font size="1" color="#FFFFFF"><%=rs("titft1")%></font></b></td>
</tr>
<tr>
<td colspan="2"><!--#include virtual="vd.asp" --></td>
</tr>


<tr>
<td colspan="2"><%=rs("fh")%></td>
</tr>
<tr>
<td colspan="2"><hr color="#FF9900" size="1" width="400">&nbsp;</td>
</tr>

<%Repeat1__index = Repeat1__index + 1
Repeat1__numRows = Repeat1__numRows - 1
RS.MoveNext
Wend

end if

%>



como veras en tu codigo agrege un end if es para decirle hasta donde termina es muy importante o te dara un error..



y así evitas el error...

Saludos...
__________________
Paginación en FLASH,

http://www.forosdelweb.com/f62/pagin...o-aqui-540241/
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 00:28.