Wrox Programmer Forums
|
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
 
Old August 4th, 2005, 11:54 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old August 5th, 2005, 09:00 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

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

 
Old August 8th, 2005, 10:50 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old August 8th, 2005, 01:31 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

If you split(myarray, ",") then you take the comma out, then you can use Trim to take of the leading and ending spaces.

 
Old August 8th, 2005, 04:58 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
 
Old August 8th, 2005, 06:41 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you get Rid of quotes hewstone999 Access VBA 1 April 15th, 2008 10:42 AM
How to get rid of everything except startup form. biglazy Access 9 March 23rd, 2006 07:33 PM
How do I get rid of this comma?!?!?!?! tsindos Classic ASP Databases 10 February 16th, 2006 12:55 AM
Get rid of the "You're about to delete ... " msg. dlamarche Access 3 February 23rd, 2005 02:51 PM
how to get rid of &nsbp; Lee8mm VB.NET 0 July 21st, 2003 07:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.