Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Search Page

Reply
Thread Tools

Search Page

 
 
J P Singh
Guest
Posts: n/a
 
      11-18-2003
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


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-18-2003
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


"J P Singh" <noemail@asIhatespam> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search only the page (need search of value of textboxes as well) sancha Javascript 0 08-05-2005 09:13 AM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM
Prevent 'Page has expired' when a client hits back to return to a search page Mike ASP .Net 1 08-08-2003 03:05 PM
Re: Warning Page Has Expired, I need to turn it OFF for a simple search page Kevin Spencer ASP .Net 2 07-08-2003 09:57 PM



Advertisments