Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with Webpage Query

Status
Not open for further replies.

RussOSU

Technical User
Apr 16, 2001
93
US
I am wanting to create a web based query of a database. I have 4 fields which I want to query from. I know I need to use an Ifnull/then statement so I can search by the field specified by the user. Where I am running into trouble is in the list box. I am not sure with .asp pages how to script this. I know a little vbs and very little js. Could someone help push me in the right direction.

Thanks

Russ
 
You could do this on the results page:

var1 = request.form("var1")
if var1 = "" then var1 = "%" end if

strSQL = "select * from table where var1 = '" & var1 & "';"

This would replace var1 with a wildcard if using textfields and the user left them blank. For drop-downs I always give the user the option to query against ALL records in that field:

<option selected value=&quot;%&quot;>---ALL---</option>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top