Crear Buscador
Necesito crear un buscador interno para mi sitio, por favor que alguien me ayude con el codigo.
esto lo que hace es buscar informacion que esta introducida en una base de datos y te la muestra en unas tablas:
<html>
<head>
<title>Buscar datos</title>
</head>
<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF" bgcolor="#0000FF">
<p><font face="Arial">Resultados obtenidos con <strong><%=Request("Criterio") %></strong></font></p>
<%Languaje=VBScript %>
<%
Dim Conexion,Tabla
Set Conexion=Server.CreateObject("adodb.connection")
Set Tabla=Server.CreateObject("adodb.recordset")
Dim Temp,Rango
Rango=Request("Tipo")
Conexion.Open "stock"
If Rango="1" Then
Temp="Select * From alma Where UCase([NomAlmacen])='" & UCase(Request("Criterio")) & "'"
Else
Temp="Select * From alma Where InStr(UCase([NomAlmacen]),'" & UCase(Request("Criterio")) & "')>0"
End If
Tabla.Open Temp, Conexion
If Tabla.BOF And Tabla.EOF Then
%>
<p><font face="Arial">No se ha encontrado ningún registro que reúna las condiciones del criterio <strong><%=Request("Criterio")%></strong> en la Base de Datos</font></p>
<%
Else
%>
<div align="center"><center>
<table border="1" cellpadding="2" width="100%" bordercolor="#000000" style="border-collapse: collapse" height="45">
<tr>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre del almacén</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nº de piezas</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre de las Piezas</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre de la promoción</font></strong></font></td>
</tr>
<% While Not Tabla.EOF%>
<tr>
<td width="25%" height="19"><%=Tabla.Fields("NomAlmacen")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NumPiezas")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NomPiezas")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NomPromocion")%> </td>
</tr>
<%
Tabla.MoveNext
Wend
Tabla.Close
Conexion.Close
End If
%>
</table>
</center></div>
<p> </p>
<p><a href="index.htm">- Volver al menú principal</a></p>
</body>
</html>
<html>
<head>
<title>Buscar datos</title>
</head>
<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#FFFFFF" bgcolor="#0000FF">
<p><font face="Arial">Resultados obtenidos con <strong><%=Request("Criterio") %></strong></font></p>
<%Languaje=VBScript %>
<%
Dim Conexion,Tabla
Set Conexion=Server.CreateObject("adodb.connection")
Set Tabla=Server.CreateObject("adodb.recordset")
Dim Temp,Rango
Rango=Request("Tipo")
Conexion.Open "stock"
If Rango="1" Then
Temp="Select * From alma Where UCase([NomAlmacen])='" & UCase(Request("Criterio")) & "'"
Else
Temp="Select * From alma Where InStr(UCase([NomAlmacen]),'" & UCase(Request("Criterio")) & "')>0"
End If
Tabla.Open Temp, Conexion
If Tabla.BOF And Tabla.EOF Then
%>
<p><font face="Arial">No se ha encontrado ningún registro que reúna las condiciones del criterio <strong><%=Request("Criterio")%></strong> en la Base de Datos</font></p>
<%
Else
%>
<div align="center"><center>
<table border="1" cellpadding="2" width="100%" bordercolor="#000000" style="border-collapse: collapse" height="45">
<tr>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre del almacén</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nº de piezas</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre de las Piezas</font></strong></font></td>
<td width="25%" bgcolor="#C0C0C0" bordercolor="#000000" height="17">
<font color="#000000"><strong>Nombre de la promoción</font></strong></font></td>
</tr>
<% While Not Tabla.EOF%>
<tr>
<td width="25%" height="19"><%=Tabla.Fields("NomAlmacen")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NumPiezas")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NomPiezas")%> </td>
<td width="25%" height="19"><%=Tabla.Fields("NomPromocion")%> </td>
</tr>
<%
Tabla.MoveNext
Wend
Tabla.Close
Conexion.Close
End If
%>
</table>
</center></div>
<p> </p>
<p><a href="index.htm">- Volver al menú principal</a></p>
</body>
</html>