I should have explained it like this....

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: I should have explained it like this....

    Darren Heinrich wrote:
    > Maybe I should have explained it like this:
    > In one record in my db I have:
    >
    > field1 = "the dog"
    > field2 = "the cat"
    > field3 = "the bird"
    >
    > I need a query that will find the above record when the user enters
    > the keywords of "dog cat bird"
    > so far my current page works well but it looks for "dog cat bird" in
    > one field, then the next fieldetc.
    >
    > Have a look: [url]http://www.dazzjazz.com/tmc/form.asp[/url]
    >
    > Here is a example of the current dynamically built query
    > --------------------------------------------------------------------------
    --
    > -----------------------------------
    > Select tblProducts.productID, tblProducts.productName,
    > tblProducts.longDescription, tblProducts.description,
    > tblManufacturers.manufacturerName FROM tblManufacturers INNER JOIN
    > tblProducts ON tblManufacturers.manufacturerId =
    > tblProducts.manufacturerId WHERE tblProducts.productName Like
    > '%digital%24bit%' OR tblProducts.longDescription Like
    > '%digital%24bit%' OR tblProducts.description Like '%digital%24bit%' OR
    > tblManufacturers.manufacturerName Like '%digital%24bit%' ORDER BY
    > productID
    > --------------------------------------------------------------------------
    --
    > -----------------------------------
    > thanks for your help.
    >
    > Darren
    See my reply to David in .asp.general in the topic "boolean search
    expressions"

    Bob Barrows.


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  2. Similar Questions and Discussions

    1. Data & secure explained
      ok...... enter in this link www.aprocre.org.ve and click in the top right button (login panel). You can see that "a secure area only for members was...
    2. W3D Streaming explained
      Streaming Brain Dump by Tom Higgins: http://www.directordev.com/learning/articles/3D_streaming_overview/default.h tm It is possible as in...
    3. Session State lost in asp.net - solution explained.
      Hello, I just thought I'd share my particular situation regarding session state periodically being "lost" in my asp.net app. I read with...
    4. How do you use Inline Actions (Explained Here For The Newbie)
      Good analysis! also works well with . That way you can chain several CDML source files together. Matt Revenaugh -------------
  3. #2

    Default I should have explained it like this....

    Maybe I should have explained it like this:
    In one record in my db I have:

    field1 = "the dog"
    field2 = "the cat"
    field3 = "the bird"

    I need a query that will find the above record when the user enters the
    keywords of "dog cat bird"
    so far my current page works well but it looks for "dog cat bird" in one
    field, then the next fieldetc.

    Have a look: [url]http://www.dazzjazz.com/tmc/form.asp[/url]

    Here is a example of the current dynamically built query
    ----------------------------------------------------------------------------
    -----------------------------------
    Select tblProducts.productID, tblProducts.productName,
    tblProducts.longDescription, tblProducts.description,
    tblManufacturers.manufacturerName FROM tblManufacturers INNER JOIN
    tblProducts ON tblManufacturers.manufacturerId = tblProducts.manufacturerId
    WHERE tblProducts.productName Like '%digital%24bit%' OR
    tblProducts.longDescription Like '%digital%24bit%' OR
    tblProducts.description Like '%digital%24bit%' OR
    tblManufacturers.manufacturerName Like '%digital%24bit%' ORDER BY productID
    ----------------------------------------------------------------------------
    -----------------------------------
    thanks for your help.

    Darren


    Darren Heinrich Guest

  4. #3

    Default Re: I should have explained it like this....

    Why don't you make them choose whether they're interested in a product name,
    or a manufacturer name, etc.?

    Anyway, rather than treat the whole set of words as one word, you can do
    something like this. (Given that I have no idea what you called your form
    field name or which collection it comes from.)

    <%
    words = split(request.form("words"))
    for i = 0 to ubound(words)
    j = " OR "
    if i = 0 then j = ""
    w = replace(words(i), "'", "''")
    sql = sql & j & " p.productName LIKE '%" & w & "%'" & _
    " OR p.longDescription LIKE '%" & w & "%'" & _
    " OR p.description LIKE '%" & w & "%'" & _
    " OR m.manufacturerName LIKE '%" & w & "%'"
    next

    ' I find your naming scheme funny and inconsistent. why
    ' not p.productLongDescription? and what purpose does
    ' the tbl prefix serve?

    sql = "SELECT p.productID, p.productName, p.description, " & _
    " m.manufacturerName, p.longDescription " & _
    " FROM tblManufactuerers m INNER JOIN " & _
    " tblProducts p ON m.manufacturerID = p.manufacturerID " & _
    " WHERE " & sql

    response.write(sql)
    %>

    And, as mentioned before, you might consider full text search. This query
    is very likely to have absolutely horrible performance, unless your tables
    have 3 or 4 rows and users are always entering the same search phrases.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]




    "Darren Heinrich" <dazzjazz@ozemail.com.au> wrote in message
    news:J8zVb.11$cW2.589@nnrp1.ozemail.com.au...
    > Maybe I should have explained it like this:
    > In one record in my db I have:
    >
    > field1 = "the dog"
    > field2 = "the cat"
    > field3 = "the bird"
    >
    > I need a query that will find the above record when the user enters the
    > keywords of "dog cat bird"
    > so far my current page works well but it looks for "dog cat bird" in one
    > field, then the next fieldetc.
    >
    > Have a look: [url]http://www.dazzjazz.com/tmc/form.asp[/url]
    >
    > Here is a example of the current dynamically built query
    > --------------------------------------------------------------------------
    --
    > -----------------------------------
    > Select tblProducts.productID, tblProducts.productName,
    > tblProducts.longDescription, tblProducts.description,
    > tblManufacturers.manufacturerName FROM tblManufacturers INNER JOIN
    > tblProducts ON tblManufacturers.manufacturerId =
    tblProducts.manufacturerId
    > WHERE tblProducts.productName Like '%digital%24bit%' OR
    > tblProducts.longDescription Like '%digital%24bit%' OR
    > tblProducts.description Like '%digital%24bit%' OR
    > tblManufacturers.manufacturerName Like '%digital%24bit%' ORDER BY
    productID
    > --------------------------------------------------------------------------
    --
    > -----------------------------------
    > thanks for your help.
    >
    > Darren
    >
    >

    Aaron Bertrand [MVP] Guest

  5. #4

    Default Re: I should have explained it like this....

    > See my reply to David in .asp.general in the topic "boolean search
    > expressions"
    Sorry Bob, I hadn't seen that reply until just now. I think we're on the
    same channel. :-)


    Aaron Bertrand [MVP] Guest

  6. #5

    Default Re: I should have explained it like this....

    Aaron Bertrand [MVP] wrote:
    >> See my reply to David in .asp.general in the topic "boolean search
    >> expressions"
    >
    > Sorry Bob, I hadn't seen that reply until just now. I think we're on
    > the same channel. :-)
    And I replied before seeing your reply ... :-)

    Bob


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139