 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 4th, 2005, 11:54 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Ok now, what's wrong with this?
Code:
<td>
<%
TheString = rs("text_data")
ArrayTemp = split(TheString, " ")
NumberOfWords = UBound(ArrayTemp) + 1
Response.Write "<P><i>Number of words:</i>" & NumberOfWords & "</br>"
i=0
For Each Word In ArrayTemp
Response.Write "<input type=""checkbox"" value=""" & Trim(ArrayTemp(i)) & """ name=""Keywordh"">" & word & "</br>"
i=i+1
next
Response.Write "</br>"
%>
</td>
response page:
Code:
If Keywordh <> "" Then
ArrayTemp = split(Keywordh," ")
whereclause = whereclause + " text_data LIKE '" & Trim(ArrayTemp(0)) & "'"
i=i+1
for i=1 to ubound(ArrayTemp)
whereclause = whereclause + " AND text_data LIKE '" & Trim(ArrayTemp(i)) & "'"
next
SQL = SQL & whereclause
End If
It's able to search:
Quote:
|
quote:SELECT * FROM bible WHERE text_data LIKE 'after,' AND text_data LIKE 'death,' AND text_data LIKE 'Moses,' AND text_data LIKE 'servant,' AND text_data LIKE 'LORD'
|
but says
Quote:
|
quote:We did not find a match of "after, death, Moses, servant, LORD"!
|
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm
|
|

August 5th, 2005, 09:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
|
|
You still have the comma in the search. Please split that comma out of there.
split(Keywordh,",")
I don't see what your i = i + 1 is supposed be doing. I could be wrong but unless you use 'for i = 0 ubound(myarray)' you won't get the first array value 'myarray(0)'.
Also, if you want to use LIKE you're going to have to program in the wild card, '%':
SELECT * from bible where text_data LIKE '%after%' AND text_data LIKE '%death%';
Try this out in Query Analyzer and see what kind of output you get. Once you get your SQL statement correct then you can just program it into the app.
Fudd
|
|

August 8th, 2005, 10:50 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
OK. Now, how do you get rid of punctuation from within sql? Because I did the split function on the space bar to separate the words but the punctuation remains.
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm
|
|

August 8th, 2005, 01:31 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
|
|
If you split(myarray, ",") then you take the comma out, then you can use Trim to take of the leading and ending spaces.
|
|

August 8th, 2005, 04:58 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
|
|
what about "; : , . ? "
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm
|
|

August 8th, 2005, 06:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
|
|
Replace(Replace(Replace(Replace(Replace(Replace(my array(i),";",""),":",""),",",""),".",""),"?","")," '","''")
This may not be the best way, but it will work. You may want to write a 'strip' function to get the same results that way you can use it on multiple variables.
|
|
 |