Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/03/2004, 08:05
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años, 11 meses
Puntos: 5
hola....
bueno, aqui esta lo que me pediste...

son dos archivos. uno se llama buscar.asp y el otro resultado.asp
chequea:


buscar.asp


<html>
<head>
<title>Buscar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000"><center>
<p><b><font size="5">MI BUSCADOR</font></b> </p>

<form name="form1" method="post" action="resultado.asp">
<input type="text" name="textfield">
<input type="submit" name="Submit" value="Buscar">
</form></center>
</body>
</html>




resultado.asp



<html>
<head>
<title>Rsultados de la Búsqueda</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<%
buscar = Request.Form("textfield")

if buscar <> "" then

TamPagina = 10

if Request.Querystring("pagina") = "" then
PaginaActual = 1
else
PaginaActual = CInt(Request.Querystring("pagina"))
end if

set oConn = Server.CreateObject("ADODB.Connection")
set RSBusqueda = Server.CreateObject("ADODB.Recordset")

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & Server.MapPath("tabla4.mdb") & ";"

sSQL = "SELECT ORIGINAL, MARCA, muestra FROM Equivalencias WHERE ORIGINAL LIKE '%"&buscar&"%'"

RSBusqueda.PageSize=TamPagina
RSBusqueda.CacheSize=TamPagina

RSBusqueda.Open sSQL, oConn, 1, 2

PaginasTotales = RSBusqueda.PageCount
Total = RSBusqueda.recordcount

if PaginaActual < 1 then
PaginaActual = 1
end if

if PaginaActual > PaginasTotales then
PaginaActual = PaginasTotales
end if

Tot = 0
RSBusqueda.AbsolutePage = PaginaActual
if RSBusqueda.bof=false and RSBusqueda.eof=false then
%>
<table width="100%" align="center" border="0" cellspacing="2" cellpadding="2">
<%
while not RSBusqueda.eof and Tot < TamPagina
%>
<tr>
<td><%=(RSBusqueda("marca"))%></td>
</tr>
<%
Tot = Tot + 1
RSBusqueda.movenext
wend
%>
</table>
<%
end if
%>

<br>

<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>
<%
If PaginaActual > 1 Then
response.Write("<a href=""resultado.asp&pagina=" & PaginaActual - 1 & """>[&lt;&lt; Ant.]</a> ")
End If

For J = 1 To PaginasTotales
If J = PaginaActual Then
response.Write("<font Color=red><B> " & J & " </B></font>")
Else
response.Write("<a href=""resultado.asp&pagina=" & PaginaActual - 1 & """>" & J & "</a> ")
End If
Next

If PaginaActual < PaginasTotales Then
response.Write("<a href=""resultado.asp&pagina=" & PaginaActual - 1 & """>[Sig. &gt;&gt;]</a>")
End If
%>
</td>
</tr>
</table>

<%
else
response.Write("<center>Por favor, especifique su búsqueda.<br><br>")
response.Write("<a href=""javascript:history.back()"">Regresar</a></center>")
end if
%>

</body>
</html>




esta paginado de 10 en 10 registros...
cualquier cosa que no te funcione por favor avisame, no lo he probado pero estoy seguro que esta bien. lo unico que mando a imprimir es el campo marca para que vieras el ejemplo solamente.

bueno, estare aqui conectado por si necesitas algo mas
saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.