How to use string values? I really need help for this. Thanks.

M

Miguel Dias Moura

Hello,

I am working on an ASP.NET/VB web site with Microsoft SQL 2000 database.

I have a page with a search form where keywords are submitted.
Consider I write the the keywords 'asp' and 'book'. The results page is
called as follows: results.aspx?search=asp%20book

Then I use this script in results.aspx to put the keywords in a string:

Sub Page_Load(sender As Object, e As System.EventArgs)
Dim keywords() As String =
Request.QueryString("search").Split(CChar(""))
End Sub

My table is set for FULL TEXT SEARCH.
Consider the SQL when I look for records containing 'asp' and 'book':

SELECT *
FROM dbo.documents
WHERE CONTAINS (*, 'ASP or BOOK')

This SQL looks only for these words. What I need is to look for records
that contain the Keywords included in the string keywords().

Can you tell me how to access the string values in the SQL and use it?

Thank You,
Miguel
 
L

Leo

How about:

dim key as string = request.querystring("search").replace(" ", " or ")
this should turn the "asp book" into asp or book"
then
dim strSQL as string=string.format("SELECT * FROM dbo.documents WHERE
CONTAINS(*, '{0}), key)
 

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

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top