Forums

ASP

This topic is locked

Access, ASP, DWMX & Search engine help.

Posted 27 Aug 2005 14:04:51
1
has voted
27 Aug 2005 14:04:51 Malcolm X posted:
Access, ASP, DWMX & Search engine help.

Heya all. I am using Dreamweaver MX 04, ASP and creating a database in Access.

I would like to learn how to add a search page to my website which would search the Access database and return the information back to the screen.

Can anyone suggest the best way to do this in Dreamweaver, if this is not possible can anyone suggest where I may find a tutorial which would give me an idea on how to do so.

Thanks to all.

Mal.

Replies

Replied 29 Aug 2005 11:36:30
29 Aug 2005 11:36:30 Michael Behan replied:
You need 2 pages.

Page 1: search.asp
this has a form with as many fields as you want. Text boxes and drop downs are the easiest to use. the form action should be set to results.asp

Page 2: results.asp
create a recordset on this page (use advanced view in the create recodset dialog box) and type something like this
SELECT * FROM tableName
WHERE field1 LIKE 'param1' AND
field2 LIKE 'param2'

[field1 and field2 are the names of the database fields to be searched and tableName is the name of the table]

then define variables below where you typed that in like this

param1 | % | Request.Form("nameOfFormField"
param2 | % | Request.Form("nameOfOtherFormField"

[the nameOfFormField should be replaced with whatever names you gave the form fields on search.asp]
[using LIKE instead of = and % for the default value means if the user doesnt enter anything in the form it will return all results for that field rather than none]

then on this page drag in the values from the recordset that you want to display. and put them in a repeatRegion

and thats that.

There is a wizzard in dreamweaver for doing this (insert>>application>>advanced(or simple) search. but I would reccomend doing it yourself. Also the help in dreamweaver goes through what I outlined above in more detail (2 articles, building a search page (ASP) and building a results page(ASP))

Reply to this topic