Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/01/2010, 06:56
bewmaster
 
Fecha de Ingreso: diciembre-2009
Mensajes: 85
Antigüedad: 14 años, 8 meses
Puntos: 0
Exclamación ayuda con paginación

Saludos colegas, estoy intentando paginar este trabajo pero no me sale sera que me pueden echar una mano, lo que quiero es que si hay 200 datos en mi base de datos pues me muestre 10 en cada pagina.. espero me puedan ayudar
************DODIGO*****parte 1******
<%
set rsLink = Server.CreateObject("ADODB.Recordset")
rsLink.ActiveConnection = MyConnString
rsLink.Source = "SELECT CAT_ID, foto, SUB_ID, LINK_APPROVED, LINK_DATE, LINK_DESC, LINK_EMAIL, LINK_ID, LINK_NAME, (LINK_RATE/NO_RATES) AS RATING, LINK_RATE, LINK_URL, NO_HITS, NO_RATES, SUB_ID, TOTAL_COMMENTS FROM LINKS WHERE LINK_APPROVED = 1 ORDER BY LINK_DATE DESC"
rsLink.CursorType = 0
rsLink.CursorLocation = 2
rsLink.LockType = 3
rsLink.Open()
rsLink_numRows = 0
%>
<%
'repeat2_numRows= cantidad de items que se reflejan en pantalla....
Dim Repeat2__numRows
Repeat2__numRows = 25
Dim Repeat2__index
Repeat2__index = 0
rsLink_numRows = rsLink_numRows + Repeat2__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
rsLink_total = rsLink.RecordCount

' set the number of rows displayed on this page
If (rsLink_numRows < 0) Then
rsLink_numRows = rsLink_total
Elseif (rsLink_numRows = 0) Then
rsLink_numRows = 1
End If

' set the first and last displayed record
rsLink_first = 1
rsLink_last = rsLink_first + rsLink_numRows - 1

' if we have the correct record count, check the other stats //
'si tenemos el número de registros correcto, consulte las estadísticas de otros
If (rsLink_total <> -1) Then
If (rsLink_first > rsLink_total) Then rsLink_first = rsLink_total
If (rsLink_last > rsLink_total) Then rsLink_last = rsLink_total
If (rsLink_numRows > rsLink_total) Then rsLink_numRows = rsLink_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
'si no sabemos el número de registros, de forma manual contarlos

If (rsLink_total = -1) Then

' count the total records by iterating through the recordset
''Contar los registros totales de la iteración a través de los registros
rsLink_total=0
While (Not rsLink.EOF)
rsLink_total = rsLink_total + 1
rsLink.MoveNext
Wend

' reset the cursor to the beginning
If (rsLink.CursorType > 0) Then
rsLink.MoveFirst
Else
rsLink.Requery
End If

' set the number of rows displayed on this page
'establecer el número de filas que se muestran en esta página
If (rsLink_numRows < 0 Or rsLink_numRows > rsLink_total) Then
rsLink_numRows = rsLink_total
End If

' set the first and last displayed record
'establecer el primer y el último registro muestra
rsLink_first = 1
rsLink_last = rsLink_first + rsLink_numRows - 1
If (rsLink_first > rsLink_total) Then rsLink_first = rsLink_total
If (rsLink_last > rsLink_total) Then rsLink_last = rsLink_total

End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs = rsLink
MM_rsCount = rsLink_total
MM_size = rsLink_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

' use index parameter if defined, otherwise use offset parameter
r = Request.QueryString("index")
If r = "" Then r = Request.QueryString("offset")
If r <> "" Then MM_offset = Int(r)

' if we have a record count, check if we are past the end of the recordset **si tenemos un número de registros, compruebe si estamos más allá del final del conjunto de registros
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If

' move the cursor to the selected record
i = 0
While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
i = i + 1
Wend
If (MM_rs.EOF) Then MM_offset = i ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

' walk to the end of the display range for this page
i = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
MM_rs.MoveNext
i = i + 1
Wend

' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = i
If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
End If

' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If