Hola, pensaba que esto no me iba a generar inconveniente, pero viendo los resultados, me ha generado más que eso, una pérdida de tiempo que no había contemplado para esta etapa del trabajo. Quiero paginar un RS, pero el problema es que no se como hacerlo porque lo saco con el método getRows, y la verdad se me complica. Este es el código, si alguien sabe como lo podría hacer, se lo agradecería mucho que me de una pista en esto. Saludos y muchisimas gracias!.
NOTA: Luego de probar varios códigos distintos, este fue el último que probé. Me muestra todos los resultados por más que le haya puesto en la propiedad pagesize un valor de 5 únicamente. Cuando hago click en los links de las diferentes páginas no pasa nada. Como podría solucionarlo?
Const Imagen = 0
Const Precio = 2
Const Nombre = 1
Const Id = 3
Dim Pagina, IdNegocio, fst_row, snd_row, trd_row
Pagina = Request.QueryString("pg")
IdNegocio = Request.QueryString("Id")
fst_row = 0
snd_row = 1
trd_row = 2
If Pagina = "" then
Pagina = 1
else
Pagina = CInt(Pagina)
end if
set conexion = Server.CreateObject("ADODB.Connection")
conexion.Open strConn
set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open "SELECT Imagen, Nombre, Precio, Id FROM Productos WHERE IdNegocio = 1 ORDER BY Nombre ASC", conexion
RS.PageSize = 5
RS.CacheSize = 5
RS.AbsolutePage = Pagina
total_pages = RS.PageCount
RS_Cols = RS.GetRows
RS.Close
set RS = nothing
conexion.Close
set conexion = nothing
if Pagina > 1 then
%>
<a href="new.asp?pg=<%=Pagina - 1%>" class="pagina">Anterior</a>
<%
end if
For i=1 to total_pages
%>
<a href="new.asp?pg=<%=i%>" class="pagina"><%=i%></a>
<%
next
if Pagina < total_pages then
%>
<a href="new.asp?pg=<%=Pagina + 1%>" class="pagina">Siguiente</a>
<%
end if
%>
<table border="0" width="600" align="center" cellpadding="0" cellspacing="0" ID="Table6">
<%
For a=0 to UBound(RS_Cols,2)
%>
<tr>
<td width="200" height="140" align="center" valign="bottom" class="celda_imagen"><img src="<%=RS_Cols(Imagen,fst_row)%>" width="80" height="80"></td>
<td width="200" align="center" valign="bottom" class="celda_imagen"><img src="<%=RS_Cols(Imagen,snd_row)%>" width="80" height="80"></td>
<td width="200" align="center" valign="bottom" class="celda_imagen"><img src="<%=RS_Cols(Imagen,trd_row)%>" width="80" height="80"></td>
</tr>
<tr>
<td height="15" align="center"><a href="ver_mas.asp?id_prod=<%=RS_Cols(Id,fst_row)%> " title="más Info" class="producto"><%=Left(RS_Cols(Nombre,fst_row),1 8)%>...</a></td>
<td height="15" align="center"><a href="ver_mas.asp?id_prod=<%=RS_Cols(Id,snd_row)%> " title="más Info" class="producto"><%=Left(RS_Cols(Nombre,snd_row),1 8)%>...</a></td>
<td height="15" align="center"><a href="ver_mas.asp?id_prod=<%=RS_Cols(Id,trd_row)%> " title="más Info" class="producto"><%=Left(RS_Cols(Nombre,trd_row),1 8)%>...</a></td>
</tr>
<tr>
<td height="15" align="center" class="celda_descripcion">AR $ <%=RS_Cols(Precio,fst_row)%></td>
<td height="15" align="center" class="celda_descripcion">AR $ <%=RS_Cols(Precio,snd_row)%></td>
<td height="15" align="center" class="celda_descripcion">AR $ <%=RS_Cols(Precio,trd_row)%></td>
</tr>
<tr>
<td height="20" align="center"><a href="add.asp?cant=1&id=<%=CInt(RS_Cols(Id,fst_row ))%>"><img src="Imágenes/comprar_button.jpg" border="0"></a></td>
<td align="center"><a href="add.asp?cant=1&id=<%=CInt(RS_Cols(Id,snd_row ))%>"><img src="Imágenes/comprar_button.jpg" border="0"></a></td>
<td align="center"><a href="add.asp?cant=1&id=<%=CInt(RS_Cols(Id,trd_row ))%>"><img src="Imágenes/comprar_button.jpg" border="0"></a></td>
</tr>
<%
fst_row = fst_row + 3
snd_row = snd_row + 3
trd_row = trd_row + 3
if fst_row > UBound(RS_Cols, 2) OR snd_row > UBound(RS_Cols, 2) OR trd_row > Ubound(RS_Cols, 2) then
exit for
end if
next
%>
</table>