Search with the DRW

J

Jeff

I am working on a knowledge base search engine.

I am searching from a form on a webpage named kbsearch.asp that has a text
box that is named KBKeyword. There are other text boxes on the form but I
didn't think it would affect the query. The other text boxes are KBTitle,
KBAuthor and KBSymtoms.

The form posts to a page named KBSearchResults.asp that has the database
results on it.

I have decided that I will try the SQL Full Text index to search with. I
have Full Text indexing setup and running fine. (To the best of my knowledge)

I am trying the following query in the DRW and it contains errors according
to the DRW.

select KBNumber,KBKeyword,KBTitle,KBSymptoms from KB where
contains((KBKeyword,KBTitle,KBSymptoms), '::KBKeyword ::')

I know the query works because I can hard code the varible '::KBKeyword::'
to 'NAT' or somthing else and it works fine. I don't know how to pass the
KBKeyword varible properly.
 
J

Jeff

No the the change didn't work. The DRW wizard still gives the query contains
errors message. I wanted to use the contains or freetext. but went with your
suggestion to test. Maybe frontpage can't handle the way the query is
structured?
 
K

Kathleen Anderson [MVP - FrontPage]

Jeff:
I took another look at your original SQL - you don't have a fieldname for
the contains or like to work with, like this:
Select KBNumber,KBKeyword,KBTitle,KBSymptoms from KB where something LIKE
((KBKeyword,KBTitle,KBSymptoms), '%::KBKeyword ::%')



--

~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web: http://www.spiderwebwoman.com/resources/
 
J

Jeff

I tried

SELECT KBNumber,KBKeyword,KBTitle,KBSymptoms FROM KB WHERE KBKeyword Like
'%::KBKeyword::%' CONTAINS ((KBKeyword,KBTitle,KBSymptoms), '::KBKeyword::')

I looked at msdn's CONTAIN examples and some didn't have to have anything
after the WHERE. I also tried a couple of variations.

Remember the original example works if you hard code the '::KBKeyword::'
varible to 'NAT' or some other static entry.
 
K

Kathleen Anderson [MVP - FrontPage]

You can't use LIKE and CONTAINS in the same statement unless they are
separated by an AND or an OR.

If you are using a search form field, the SQL statement needs to look like
this:
SELECT * FROM Categories WHERE (CategoryName LIKE '%::CategoryName::%')

If you manually enter the Value, the SQL statement needs to look like this:
SELECT * FROM Categories WHERE (CategoryName LIKE '%text string%')

If KBKeyword is the name of your search form field, try this and see if it
works:

SELECT KBNumber,KBKeyword,KBTitle,KBSymptoms FROM KB WHERE KBKeyword Like
'%::KBKeyword::%'

--

~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web: http://www.spiderwebwoman.com/resources/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top