Sarah,
Couple of things off the top of my head:
1. You're including the wildcard character for the LIKE syntax in your
CONTAINS call. It should be:
"SELECT * FROM PRODUCT WHERE CONTAINS (DESCRIPTION,'" & DESCRIPTION & "') "
2. You're putting WAY too much work into constructing elaborate SQL
statements in your VBScript code. Try getting your query to work in Query
Analyzer first by putting most of this stuff into a stored procedure that
you can call with a minimum of parameters from your page. Make it simple.
3. Along the same line - try to avoid using LIKE if you can. There are many
paths through your code that result in clauses that don't filter at all, but
are still in the SQL statement. Build the SQL conditionally instead. In
other words, rather than setting CATEGORY = "(product.CATEGORY LIKE '%%') OR
(product.CATEGORY)", set it to "" if you want all and "AND product.CATEGORY
= '"& CATEGORY &"'" if you want to filter. This won't add unnecessary
clauses. Better yet, put it into a stored procedure.
--
Jeff Wilson
President
The Boolean Group, Inc.
(xxx) xxx-xxxx
Glendale, CA
"Sarah Margolis" <sarahmargolis@m...> wrote in message
news:63292@s..._language...
>
> Dear Everyone,
>
> I am trying to change the following SQL statement so that it will do a
> "fuzzy" CONTAINS match for "DESCRIPTION" :
>
> SRCH_DESCRIPTION =3D
> Replace(Request("SRCH_DESCRIPTION"),"'","''")SRCH_MANUFACTURER =3D
> Replace(Request("SRCH_MANUFACTURER"),"'","''")
>
> SRCH_CATEGORY =3D Replace(Request("SRCH_CATEGORY"),"'","''") DESCRIPTION
> =3D Replace(Request("DESCRIPTION"),"'","''")
>
> CATEGORY =3D Replace(Request("CATEGORY"),"'","''")
>
> MESSAGE =3D Replace(Request("MESSAGE"),"'","''")
>
> LONG_DESCRIPTION =3D Replace(Request("LONG_DESCRIPTION"),"'","''")
>
> ISBN =3D Replace(Request("ISBN"),"'","''")
>
> MANUFACTURER =3D Replace(Request("MANUFACTURER"),"'","''")
>
> LANGUAGE =3D Replace(Request("LANGUAGE"),"'","''")
>
> Subcategory =3D Replace(Request("Subcategory"),"'","''")
>
> PRODUCT_ID =3D Request("PRODUCT_ID")
>
>
>
> If Request("ORDER_FLAG") =3D "1" Then
>
>
> If Request("SRCH_MANUFACTURER") =3D "ALL" Then
>
> MANUFACTURER =3D "product.MFG LIKE '%%'"
>
> Else
>
> MANUFACTURER =3D "product.MFG LIKE '"& SRCH_MANUFACTURER &"'"
>
> End If
>
> PRODUCT_ID =3D Request("SRCH_PRODUCT_ID")
>
>
> If Request("SRCH_CATEGORY") =3D "ALL" Then
>
> CATEGORY =3D "product.CATEGORY LIKE '%%'"
>
> Else
>
> CATEGORY =3D "product.CATEGORY =3D '"& SRCH_CATEGORY &"'"
>
> End If
>
> Else
>
> If Request("CATEGORY") =3D "ALL" OR Request("CATEGORY") =3D "" Then
>
> CATEGORY =3D "(product.CATEGORY LIKE '%%') OR (product.CATEGORY =3D '')"
>
> Else
>
> CATEGORY =3D "product.CATEGORY =3D '"& CATEGORY &"'"
>
> End If
>
>
> If Request("MANUFACTURER") =3D "ALL" OR Request("MANUFACTURER") =3D ""
> Then
>
> MANUFACTURER =3D "(product.MFG LIKE '%%') OR (product.MFG =3D '')"
>
> Else
>
> MANUFACTURER =3D "product.MFG LIKE '"& MANUFACTURER &"'"
>
> End If
>
> End If
>
> SQLStmt =3D "SELECT * FROM PRODUCT WHERE " _
>
> & "((DESCRIPTION LIKE '%" & DESCRIPTION & "%') AND ((DESCRIPTION LIKE
> '%" & LONG_DESCRIPTION & "%') OR (LONG_DESCRIPTION LIKE '%" &
> LONG_DESCRIPTION & "%') OR (MESSAGE LIKE '%" & LONG_DESCRIPTION & "%'))
> AND (MESSAGE LIKE '%" & MESSAGE & "%') AND (LANGUAGE LIKE '%" & LANGUAGE
> & "%') AND (Subcategory LIKE '%" & Subcategory & "%') AND (ISBN LIKE '%"
> & ISBN & "%') " _
>
> & "AND (PRODUCT_ID LIKE '%" & PRODUCT_ID & "%') " _
>
> & "AND ((" & CATEGORY & ") " _
>
> & "AND (" & MANUFACTURER & "))) " _
>
> & "ORDER BY PRODUCT_ID DESC
>
> End if
>
> I've been trying:
>
> "SELECT * FROM PRODUCT WHERE CONTAINS (DESCRIPTION, '%" & DESCRIPTION &
> "%') " _
>
> & "AND ((DESCRIPTION LIKE... etc.
>
>
>
> When I search the database for the description "Julius Paulsen" I get
> the error message:
>
> HTTP 500 - Internal server error
> Internet Explorer
> If I am not including enough info, please let me know. Thank you for
> your help.
>
>
>
> Best,
>
> Sarah Margolis
> Head Programmer, Mojave Internet
> sarahmargolis@m...
> 415 S. Topanga Canyon Blvd. #114, Topanga, CA 90290
> phone: + 1 310 455-0589; FAX: +x xxx xxx xxxx
>
>
>
>