How can I make ASP output results not support html syntax?

Source: Internet
Author: User
Original user aspboy1
Many of my friends wrote to ask me how to implement intra-site search. In fact, it is very easy to implement intra-site fuzzy search using ASP.
Here we will only share with you the specific implementation ideas. First, we need to build a database that stores information in the station.
Assume that the data structure of the database wz. mdb that stores the article is as follows:
Wz. mdb
Field type description
Wid: ID
Wauth text author
Wsubject text article title
Wcontent
Other keywords in wkey text
Adding data in the database wz. mdb must be implemented by another program, which is relatively easy. It is not described here.
1.search.html 'search page
<Html>
<Body>
<P> enter a keyword. </p>
<Form name = fmsearch action = searchact. asp method = post>
'Searchact is the search handler for processing forms
<Input type = text name = keystr size = 28>
<Input type = submit name = sou value = Search>
</Form>
</Body>
</Html>
2. searchact. asp: Search handler for processing forms
<% Keystr = Request. form ("keystr") 'receives the keyword submitted by search.html.
If keystr = "" then
Response. write "<p> Error. Enter the keyword"
Response. end
End if
Set dbconn = server. createobject ("adodb. connection ")
'Create a data connection object
Conpath = "DBQ =" & server. mappath ("wz. mdb ")
'Get the actual path of wz. mdb
Dbconn. Open "DRIVER = {Microsoft Access Driver (*. mdb)};" & conpath
'Open wz. mdb
Set rs = server. createobject ("adodb. recordset ")
'Create record set
Sqlstr = "select wid, wauth, wsubject from ozg "&
"Where wsubject Like '%" & keystr & "%' or "&
"Wauth like '%" & keystr & "%' or wcontent like '%" & keystr & "%' or "&
"Wkey like '%" & keystr & "% 'Order by wid desc"
'Sqlstr is the query statement, which is the core part of the search.
Rs. open sqlstr, dbconn, 3, 1 'to obtain records that meet the conditions.
If not rs. eof then
Response. write "<p> A total of articles meeting the conditions are found based on your input conditions" & rs. recordcount
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.