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

Discussion in 'ASP .Net' started by Miguel Dias Moura, Dec 10, 2004.

  1. 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
     
    Miguel Dias Moura, Dec 10, 2004
    #1
    1. Advertising

  2. Miguel Dias Moura

    Leo Guest

    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)

    "Miguel Dias Moura" <md*REMOVE*moura@*NOSPAM*gmail.com> wrote in message
    news:...
    > 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
    >
     
    Leo, Dec 11, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amir
    Replies:
    3
    Views:
    599
  2. nc
    Replies:
    1
    Views:
    502
    nice.guy.nige
    Feb 3, 2005
  3. =?Utf-8?B?Q2hyaXM=?=

    Help Help. I really need some help with this

    =?Utf-8?B?Q2hyaXM=?=, Jan 31, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    567
    =?Utf-8?B?SmFzb24gVmVybWlsbGlvbg==?=
    Jan 31, 2007
  4. Jeannie
    Replies:
    15
    Views:
    893
    Jeannie
    Aug 30, 2005
  5. Replies:
    30
    Views:
    997
    Arne Vajhøj
    Feb 10, 2008
Loading...

Share This Page