URGENT: insert database (asp), how to give search options on search form
Posted on 2003-03-13
In frontpage 2002 (& probably 2000): Insert -> Database -> Results, I create a connection to an access database, etc, etc until I have a search button that searches the accessdb through a cuztomizable SQL query, it works and returns results.
The question is, I would like to have options for different sql queries! the user must choose whether he wants to search the country field, or the name field, etc. why is it so hard to do/invisible in frontpage. To make things more clear, here is the piece of ASP coding I changed to do that, within the code created by Frontpage:
The query line:
fp_sQry="SELECT * FROM DRI WHERE (Country Like '%::search_text::%')"
is replaced by these:
if Request("lstcriteria")="Country or City" then fp_sQry="SELECT * FROM DRI WHERE (Country Like '%::search_text::%')"
if Request("lstcriteria")="Institution Name" then fp_sQry="SELECT * FROM DRI WHERE (Name Like '%::search_text::%')"
that way the query used is decided by the dropdown list "lstcriteria". i.e to search the country or the name. But this simple code modification doesn't work, as soon as I do it, the search returns all records on every search. Probably because there is some back-end coding that is done in other places by frontpage, that is not compatible with the two queries. Also, I know that opening the ASP page with frontpage automatically overwrites the modified code. I didn't open it, so that is not the problem.
How can I give the user options to search different fields??
Bare in mind that I am no programmer, I can write some code and some VB programs sometimes but that's it. ALso, I know that interdev can do this very easily, but I have no time to learn it! how to do it in a simple way?