
22/05/2002, 16:00
|
| | Fecha de Ingreso: enero-2002 Ubicación: Yerba Buena - Tucumán
Mensajes: 259
Antigüedad: 23 años, 3 meses Puntos: 0 | |
Re: Problema con paginacion con base sql Yo no conozco el componente que estas usando pero te paso el codigo que yo utilizo para realizar la paginación y si me funciona con cualquier base de datos, el código es el siguiente:
<%'p es la posicion de comienzo en el vector de registros
if Request.Querystring("ref") = "" then
p = 0
else
p = Cint(Request.Querystring("ref"))
end if
SQL = "SELECT id,fecha,obra,sala,precio,id_categoria FROM eventos WHERE Month(fecha) = Month(now()) AND id_categoria=" & rubro & " ORDER BY fecha"
'abrimos el recordset con tipo de cursor 3 para poder utilizar bookmarks y saber el nº total de registros
rs.Open SQL, cnn, 3, 1
total_registros = rs.RecordCount
banerror = 0
If total_registros > 0 then
rs.Move p
inicio = rs.Bookmark
mitabla = rs.GetRows(10,inicio)
else
banerror = 1
end if
rs.Close
set rs = Nothing
cnn.Close
set cnn = Nothing
id = 0
fecha = 1
obra = 2
sala = 3
precio = 4
id_categoria = 5
<table width=98%>
<%For i = 0 to Ubound(mitabla,2)%>
<tr>
<td>
<%=mitabla(obra,i)%>
</td>
<td>
<%=mitabla(sala,i)%>
</td>
</tr>
<%Next%>
</table>
<%If Ubound(mitabla,2)+1 < total_registros then
If (total_registros mod 10) = 0 then
nro_paginas = Cint(total_registros / 10)
else
nro_paginas = Cint(total_registros / 10) + 1
end if%>
<table>
<tr>
<td>
Página
<%For i=0 to nro_paginas-1%>
<%If p = i*10 then%>
<a href="bares.asp?ref=<%=i*10%>"> <font color=DarkOrange><u><%=i+1%></u></font></a>
<%else%>
<a href="bares.asp?ref=<%=i*10%>"> <%=i+1%></a>
<%end if%>
<%If i < nro_paginas-1 then
Response.Write(" | ")
end if
Next%>
</b></font>
</td> Continúa .... |