Search Page

J

J P Singh

Hi All

I have been asked to build a search page to allow users to search the
database. The issue is that the search page in ASP must mirror out existing
search screen on the VB application.

I need to give a search screen which will have lots of dropdowns and free
text fields. I want to dynamically build a search query to include fields
that the user chooses to enter something in.

For example I might have fields like this on form

Name
Area
EmpNumber
Gender
Postcode

The user enters name and postcode

I would like to create a query like this

Select * from info where name like request.form("Name") and Postcode like
request.form(Postcode)

but if the user only entered his name the query should be

select * from info where name like request.form("Name")

does anyone know how this can be done.

cheers

Jas
 
R

Ray at

You can check to see which fields were filled out by getting the value
beforehand.


Dim bName, bPostcode
bName = Trim(Request.Form("name")) <> ""
bPostcode = Trim(Request.Form("postcode")) <> ""

Then build your sql query based on the boolean values.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top