|
| |
|
|
RickBDCR
Posts: 2 Joined: 2/20/2003 Status: offline
|
Hyperlink Query for Multiple Parameters - 2/20/2003 11:42:34
I have a database that has a number of columns. The combination of fields used in a search varies with the type of product they are looking for. I like to pass the search parameters in a link but I cannot figure out how to have all searches use the same results page. Currently I need to create a new results page for every combination of parameters. For example, I have to customize a results page for the the three parameters in this search: http://www.datacenterresources.com/results7.asp?f1=Local Access&f2=Controls Multi-Platform&f4=Multi-user I have tried setting the default values to % but when I do that I get no results. What I am doing works but I am up to 10 different results pages. I would really like to have a way to use just one that will work for all queries.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Hyperlink Query for Multiple Parameters - 2/20/2003 12:14:21
It sounds like you' re using the DRW. I have done similar things with DRW. What I' ve done is first put the DRW on a Spooky Diet. Then I build the SQL code ' on-the-fly' by determining if there is data in each of my fields. If there is data, add the query parameters. If not, skip it. Something like this: <% ' Function to build query for search Dim mySQL mySQL = " " If Request(" Field1" ) = " " then mySQL = " " else mySQL = " (Field1 LIKE ' %::Field1::%' )" end if If Request(" Field2" ) > " " then If mySQL = " " then mySQL = " (Field2 LIKE ' %::Field2::%' )" else mySQL = mySQL & " AND (Field2 LIKE ' %::Field2::%' )" end if end if If Request(" Field3" ) > " " then If mySQL > " " then mySQL = mySQL & " AND (Field3 LIKE ' %::Field3::%' )" Else mySQL = " (Field3 LIKE ' %::Field3::%' )" End if end if ' If query string is still blank, set a No Record Found value If mySQL = " " then mySQL = " (Field1 LIKE ' xxxx' )" end if %> Then you replace the DRW fp_sQry line with something like: fp_sQry=" SELECT * FROM myTable WHERE (" & mySQL &" )" That' s just one way. There are others. Hope it helps...
|
|
|
|
RickBDCR
Posts: 2 Joined: 2/20/2003 Status: offline
|
RE: Hyperlink Query for Multiple Parameters - 2/20/2003 16:24:18
It worked perfectly. It will definitely make my life a little easier. Thanks!
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 12:46:06
quote:
one sinle text box Try making all the requests for the same field like this: ...WHERE ((homephone LIKE ' %::searchBox::%' ) OR (workphone LIKE ' %::searchBox::%') OR (cellphone LIKE ' %::searchBox::%' ))... And be sure to use OR's if you want to search multiple fields (unless of course you really want all 3 fields to contain the number). That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
box
Posts: 167 Joined: 12/10/2002 Status: offline
|
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 15:00:22
Here is the code but it does not return any data: fp_sQry="SELECT * FROM ptinfo WHERE ((homephone LIKE ' %::phone::%' ) OR (workphone LIKE ' %::phone::%') OR (cellphone LIKE ' %::phone::%' )) ORDER BY lastname ASC"
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 15:04:44
quote:
LIKE ' %::phone::%' I might have some inadvertant space in there; see it? Just before the first %. LIKE '%::phone::%' I think it's in there on all 3. That any better?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|