Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

Adding search function in asp page

Hi,
New to ASP, i have an asp page outputs data from an access DB. I want to add search function in this page. The data is Name, Title, etc.. I want to add the Name search.

If it is easy, i would like to add the quick find search also (output the search results as you type in the search box, as in google search)

Thanks for your help
0
Basheerpt
Asked:
Basheerpt
1 Solution
 
code-colorsCommented:
Hi,

you can simply use the access query to add the search option in your page.

SearchText = request.form("<<Search Inputbox>>")

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("<<dbname.mdb>>") & ";Persist Security Info=False"

strsql = "SELECT name, title FROM <<table name> WHERE (name LIKE '%"& SearchText &"%' or title like '%"& SearchText &"%')"

set objrec = server.CreateObject("ADODB.recordset")

objrec.Open strsql,conn

while not objrec.eof
response.write "Name :" &  objrec("name") & "<br>Title :" & objrec("title") & "<br><br>"
objrec.Movenext
wend

Try It!
0
 
BasheerptAuthor Commented:
I had not seen your reply! i will try it and get you back. Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now