%
'the two functions below return the next 10 and prev 10 page number
Function getNext10(num)
pageLen = len(num)
If pageLen = 1 Then
next10 = 25
Else If pageLen>1 Then
pageRem = 25
pageTen = right(num, 1)
next10 = num + pageRem - pageTen
End If
End If
getNext10 = next10
End Function
Function getPrev10(num)
pageLen = len(num)
If pageLen = 1 then
prev10 = 1
Else If pageLen>1 then
lastNumber = right(num, 1)
prev10 = num - lastNumber - 25
End If
End If
If prev10 = 0 then
prev10 = 1
End If
getPrev10 = prev10
End Function
%>
Yedra films
PELÍCULAS DISPONIBLES
<%
If IsEmpty(Request.Querystring("PageNo")) then
CurrPage = 1
Else
CurrPage = Cint(Request.Querystring("PageNo"))
End If
If IsEmpty(Request.Form("strBusqueda")) then
SQL="select * from peliculas order by titulo asc"
Else
strParam = Request.Form("strBusqueda")
SQL="select * from peliculas where titulo like '%" & strParam & "%'"
End If
'create an instance of the ADO connection and recordset object
Set Ob_Conn = Server.CreateObject("ADODB.Connection")
Set Ob_RS = Server.CreateObject("ADODB.Recordset")
Ob_Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("data/films.mdb") & ";User Id=admin;Password=;"
Ob_RS.CursorLocation = 3
Ob_RS.Open SQL, ob_Conn
Ob_RS.PageSize = 25
If not Ob_RS.eof then
Ob_RS.AbsolutePage = CurrPage
i=0
response.write "
"
Do Until Ob_RS.AbsolutePage <> CurrPage OR Ob_RS.Eof
titulo = Ob_RS("titulo")
descripcion = Ob_RS("descripcion")
imagen = Ob_RS("imagen")%>
<%=Server.HTMLEncode(titulo)%>
<%i=i+1
Ob_RS.MoveNext
if i=5 then
response.write "
"
i=0
end if
Loop
End If
%>
<%
RSPrevPage = CurrPage -1
RSNextPage = CurrPage + 1
If Next10 > Ob_RS.PageCount Then
Next10 = Ob_RS.PageCount
End If
If Ob_RS.PageCount > 1 Then
If CurrPage > 1 Then
response.write("<< Primera ")
End If
If NOT RSPrevPage = 0 then
response.write("< Anterior ")
End If
Response.write " || "
If NOT RSNextPage > Ob_RS.PageCount Then
response.write("Siguiente > ")
End If
If NOT Next10 = Ob_RS.PageCount Then
response.write(" Última >>")
End If
End If
Ob_RS.close
Set Ob_RS = Nothing
Ob_Conn.close
Set Ob_Conn = Nothing%>