If you have a huge website with a lot of content, then it is difficult for visitors to find the stuff they need. At this time, you need a search in the site to help the visitors find the required information faster! Now you can easily implement this function with ASP, not to mention that there are so many sites that support ASP now. Use this search engine to search for any file or software information in your homepage, which can be accurate to each word! After saying so much, are you so excited, then build your own search engine according to the following steps:
(1), first use Access97 to create a database called list.mdb, set up a table called list, and then enter some file names you want to query in the list table. Corresponding links, the following four items (numbers), title (theme), word (keywords), URL (link address), as shown in the table below:
ID title word url
1 CGI tutorial local debug CGI CGI/testcgi.htm
2 Download the center of the chat room, message book download/index.htm
(2) After the database is established, you can create your ASP search page. The following is the source program of the ASP search page named Search.htm. If you need it, you can build more search:
<!-#Include file = Adovbs.inc->
<% Establish a database connection
Con = dbq =+server.mappath (list.mdb)+; defaultDir =; Dirver = {microsoft access driver (*. mdb)};
Establish a Connection object and open the database
set mycon = server.createObject (Adodb.connection)
mycon.open.con %>
Create the routine of the recordset object, open the RECORDSET object to pass the SQL string and all the connection information
<% set rs = server.createObject (adodb.recordset)
RS.Oopen Select*Form List Where Title and Word Like '%' & Request.form (Word) &% ', Mycon, Adopenstativeie
%>
Create the display information and query pages after query, you can get any name you want
<html> <head> <tictle> query results </tictle> </head>
<body bgcolor =#FFFFFF>
<p align = center> <br>
Statistical query in total < % Response.write (RS.RCORDCOUNT) %> record </p> <br>
<div Align = Center> <Center>
<Table Border = 1 Align = Center BorderColor = 000000 BerdorCoorlight =#000000 BorderColordark =#FFFFFF>
<tr align = center>
<td width = 20% align = center bgcolor =#FFFFFF> ID </td>
<td width = 60% align = center bgcolor =#FFFFFF> Theme </td>
<td width = 20% align = center bgcolor =#FFFFFF> View </td> </table>
<Table Border = 1 Align = Center BorderColor = 000000 BerdorCoorlight =#000000 BorderColordark =#FFFFFF>
<tr align = center>
<!-Extract information from the database->
< % While NOT RS.EOF %>
<tr align = center>
<td width = 20% align = center bgcolor =#fffff> <% = rs (id)%> </td>
<td width = 60% align = center BGCOLOR =#fffffFF> <% = rs (title)%> </td>
<td width = 20% align = center bgcolor =#ffffffF> <a href = <% = rs (url)% >> go </a> </td>
< % RS.Movenext %> </TR> < % Wend %> </Table> </Center> </DIV> < % RS.Close %>
< % mycon.close %>
Close the link
</body> </html>
Let's establish a search page below
<html> <head> <Title> Search page </tictle> </head>
<!-Create a search form->
<teomod = post action = search.asp>
<div align = center> <center> <p> <input type = text name = word size = 30>
<input type = submit value = submit name = b1> <input type = reset value = clear Name = b2> </p>
</center> </div> </form>
<hr width = 600 align = center>
<html>
Well, even if the search engine in this site is complete, what you have to do next is to enter the database.
The content of this article comes from www.lodoEshop.com, please indicate the source for reprinting.