Print Page | Close Window

Search Question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=11162
Printed Date: 28 March 2026 at 7:54am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Search Question
Posted By: zMaestro
Subject: Search Question
Date Posted: 12 July 2004 at 1:54am

I'm making a drug store, and I want to make a search using these criteria: Search for Drugs that:
1- Exact Match
2- Any
3- Begins With

QLSpecial = "SELECT DrugName FROM DrugTable WHERE "
IF Request("How") = "Any" Then QLSpecial = QLSpecial & "DrugName LIKE '%" & Request("Search")& "%'"
IF Request("How") = "Exact" Then QLSpecial = QLSpecial & "DrugName = '" & Request("Search")& "'"
IF Request("How") = "Begins" Then QLSpecial = QLSpecial & "DrugName ????????????????????????"

How can I search for results that Begins with somthing?

btw. it's Access Database.

thank you.

 




Replies:
Posted By: michael
Date Posted: 12 July 2004 at 12:11pm

First off, the ANY will not work properly as you want the customer to be able to search for any 1 work that matches, so if I search for 'Aspirin Capsules' and only Aspirin exists, it should still return a match, now to do that in access you may have to split the search at every space and loop through to construct your sql statement.

To do a Begins with you simply do a
& "Drugname LIKE '" & Request("Search") & "%'"
just to leave out the % in the beginning....

Another note, don't use Request use Request.Query or .Form to limit vulnerabilities.



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net