PDA

View Full Version : ASP Search problems



DaveB
February 9th, 2001, 08:00
Part of my web site is searching for a person. To do this you have to select their, sex, hair colour, eye colour, height etc, in drop down menus.

The search works fine but I cannot find a way of creating an option for selecting any height, any hair colour etc. I need something that represents 'any file'

The following is my code.


town = request.querystring("town")
sex = request.querystring("sex")
eyes = request.querystring("eyes")
build = request.querystring("build")
age = request.querystring("age")
size = request.querystring("height")
folicles = request.querystring("hairy")


strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=c:\inetpub\wwwroot\FindaDate.mdb;"
set rs = server.createobject("adodb.recordset")
sqlstmt = "SELECT * from CustomerDetails where Hair = '"&folicles&"' AND Height = '"&size&"' AND Towns = '"&town&"' AND Build = '"&build&"' AND Eyes = '"&eyes&"' AND Gender = '"&sex&"' "
rs.open sqlstmt, strprovider

If rs.eof then
response.write "<center>There are no records in the database"
response.write "<br>Please check back later</center>"
response.end
Else

Beans
February 11th, 2001, 23:53
Please clarify.

Use INNER JOIN instead of multiple AND's in your query. That would make your work easier.

DaveB
February 12th, 2001, 11:57
In a drop down menu you have 4 choices.

Black
Blue
Green
Any Colour

I want to be able to search for any colour on three or four drop down menus. I have no problem in searching for the specific colours as I just have to SELECT from CustomerDetails Where Colour = '"& colour &"'.

If the user is not bothered about the colour hair they want they can choose 'Any Colour' and people with Black, Blue and Green hair are selected.

Hope this is more specific

Cheers