|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a search form that has a text box called "searchTxt" where I want the user to be able to type in any part of the name he is searching for. When the search button is clicked, it should show all the items from my database that contain that text in the table.
If I put the text I'm searching for in the SQL it works fine. SQlStr="SELECT item_number, description, description2 FROM tblPartsMaster WHERE item_number LIKE '%SB%'" How do I look at what is in the text box on my form and search for that? |
|
#2
|
|||
|
|||
|
Hi there i think you just need to parse as a variable something like:
Code:
'Var to hold the information the user insert it in the text box
Dim strTextbox
'Grab the info from the text box and hold in the var we just create
If Request.Form <> "" Then
strTextbox = Request.Form("NAMEOFTHETEXTBOX")
End If
As for the SQL Statment in your case something like this Code:
SQlStr="SELECT item_number, description, description2 FROM tblPartsMaster WHERE item_number LIKE '" & strTextbox & "'" or Code:
SQlStr="SELECT item_number, description, description2 FROM tblPartsMaster WHERE item_number LIKE '%" & strTextbox & "%'" Hope it helps ![]() |
|
#3
|
|||
|
|||
|
Your second suggestion worked fine. Thanks for the help.
|
|
#4
|
|||
|
|||
|
Cool, no problem.
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Help with SQL LIKE |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|