|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
||||
|
||||
|
Splitting up a search string in ASP...
Hey people... I've made my first ASP website that interacts with a detabase. All fairly standard: it can display the entire contents of the db, you can input new items, update and delete items, and I've just started making a search page...[!]
It all works fine if the user just searches with one word, but if they enter more than one word and then press search, I don't know how to split their searchstring up into [an array of?] different strings to search the db with. Is this even the easiest way to do it, or am I just wasting my time? Any help please!!!!! Cheers.
__________________
Support requests via PM will be ignored! |
|
#2
|
|||
|
|||
|
dim A
A = split(strInput) this will split it on spaces A = split(strInput, ",") this will split on commas etc. strSQL = "select * from table where " for each item in A strSQL = strSQL + "column LIKE '%" & item & "%' AND " next strSQL=strSQL & "and prikey is NOT null" switch the AND to OR if you want.........depends on what you're looking for hope this helps, let me know if you need more help |
|
#3
|
|||
|
|||
|
The only problem with unatratnag's approach is that you'll end up having to AND's next to each other inside your string
;-) </grin> Vlince |
|
#4
|
|||
|
|||
|
eh what?...are?
.....ahhh cripes, yes, remove that last AND, hehe, thanks vlince ![]() make it Code:
strSQL=strSQL & "prikey is NOT null" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Splitting up a search string in ASP... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|