
Tengo un recorset en MySQL y necesito paginar una tabla,
y me da el siguiente error:
Tipo de error:
ADODB.Recordset (0x800A0CB3)
El recordset actual no admite marcadores. Puede deberse a una limitación del proveedor o del tipo de cursor seleccionado.
/miepi/paginar.asp, línea 52
El codigo es el siguiente:
<%
Dim mostrar
Dim cant_paginas
Dim pagina_actual
Dim registro_mostrado
Dim I
mostrar = 10
If Request.QueryString("page") = "" Then
pagina_actual = 1
Else
pagina_actual = CInt(Request.QueryString("page"))
End If
strQuery = "SELECT * FROM lista"
Dim Conn
Dim conn_string
conn_string = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=EBV;USER=root;PA SSWORD=123;OPTION=3;"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open(conn_string)
strQuery = "SELECT * FROM Lista"
Set RS = Conn.Execute(strQuery)
RS.PageSize = mostrar
RS.CacheSize = mostrar
cant_paginas = RS.PageCount
If pagina_actual > cant_paginas Then pagina_actual = cant_paginas
If pagina_actual < 1 Then pagina_actual = 1
If cant_paginas = 0 Then
Response.Write "No hay registros..."
Else
RS.AbsolutePage = pagina_actual
%>
<FONT SIZE="+1">Página <B><%= pagina_actual %></B> de <B><%= cant_paginas %></B></FONT>
<%
Response.Write "<BR><BR>" & vbCrLf
Response.Write "<TABLE BORDER=""1"">" & vbCrLf
Response.Write vbTab & "<TR>" & vbCrLf
For I = 0 To RS.Fields.Count - 1
Response.Write vbTab & vbTab & "<TD><B>"
Response.Write RS.Fields(I).Name
Response.Write "<B></TD>" & vbCrLf
Next
Response.Write vbTab & "</TR>" & vbCrLf
registro_mostrado = 0
Do While registro_mostrado < mostrar And Not RS.EOF
Response.Write vbTab & "<TR>" & vbCrLf
For I = 0 To RS.Fields.Count - 1
Response.Write vbTab & vbTab & "<TD>"
Response.Write RS.Fields(I)
Response.Write "</TD>" & vbCrLf
Next
Response.Write vbTab & "</TR>" & vbCrLf
registro_mostrado = registro_mostrado + 1
RS.MoveNext
Loop
Response.Write "</TABLE>" & vbCrLf
End If
RS.Close
Set RS = Nothing
oConn.Close
Set oConn = Nothing
If pagina_actual > 1 Then
%>
<a href="./paginar.asp?eje=30&page=<%= pagina_actual - 1 %>">[<< Anterior]</a>
<%
End If
For I = 1 To cant_paginas
If I = pagina_actual Then
%>
<%= I %>
<%
Else
%>
<a href="./paginar.asp?eje=30&page=<%= I %>"><%= I %></a>
<%
End If
Next
If pagina_actual < cant_paginas Then
%>
<a href="./paginar.asp?eje=30&page=<%= pagina_actual + 1 %>">[Próximo >>]</a>
<%
End If
%>