<%
dim location,category,sql,estrellas
if (request.Form("city") = "") AND (request.Form("category") = "") then
location=request.QueryString("location")
if (request.QueryString("category") = "0") then
category="0"
else
category=request.QueryString("category")
end if
else
location=request.Form("city")
category=request.Form("category")
end if
sql="SELECT * FROM Hoteles Where "
'response.Write(sql)
sql=sql + "(Poblacion='" + location + "')"
'response.Write(sql)
if category="0" then
sql=sql + " ORDER BY Nombre"
else
sql=sql + " AND (Categoria='" + category + "') ORDER BY Nombre"
end if
select case category
case "0"
estrellas=""
case "1"
estrellas="One Star"
case "2"
estrellas="Two Stars"
case "3"
estrellas="Three Stars"
case "4"
estrellas="Four Stars"
case "5"
estrellas="Five Stars"
end select
%>
<%
'response.Write(sql)
'pagina a mostrar
if request.querystring("paginaactual")<>"" then
mostrarpagina=request.querystring("paginaactual")
else
mostrarpagina=1
end if
'creamos el recordset
set MyRs=Server.CreateObject("ADODB.Recordset")
'creamos la conexion
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open Application("Conexion")
'abrimos recordset
'Set MyRs=MyConn.Execute(MySQL)
MyRs.Open sql,MyConn,3,3
if MyRs.EOF then
%>
Lo sentimos, esta búsqueda no tiene resultados.
<%
else
'cantidad de registros por pagina
cantidadregistros=20
'definicion de pagesize,pagecount,absolutepage
MyRs.pagesize=cantidadregistros
maxpagina=cint(MyRs.pagecount)
maxregistros=cint(MyRs.pagesize)
MyRs.absolutepage=mostrarpagina
contreg=0
if int(mostrarpagina)<>int(maxpagina) then '-- Si no es la última página.
hasta=mostrarpagina*5
desde=hasta-4
else
hasta=MyRs.recordcount
desde=(maxpagina*5)-4
end if
%>
La manera más fácil de encontrar un hotel en Costa Brava.
Hoteles <% response.Write(estrellas) %> en <% response.write(location) %>
<%
do while not MyRs.eof and contreg < maxregistros
%>
<%
if not MyRs.EOF then
MyRs.MoveNext
contreg=contreg+1
end if
loop
%>
<%
if (MyRs.RecordCount >= cantidadregistros) then
cero="0"
nombrescript="searchHotel.asp"
if int(mostrarpagina)<>1 then '--si no es la primer página mostrar botón anterior
ref="[ << ] "
end if
for contador=1 to maxpagina
If contador>9 then
cero=""
end if
ref=ref & " " & cero & contador & ""
else
ref=ref & "'>" & cero & contador & ""
end if
end if
next
if int(mostrarpagina)<>int(maxpagina) then '-- si no es la última página mostrar botón siguiente
ref=ref & " [ >> ]"
end if
response.write ref
end if
end if
'cerramos y destruimos el recordset y la conexion
MyRs.close
Set MyRs = Nothing
MyConn.Close
set MyConn = Nothing
%>