Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Using the CONTAINS predicate in ASP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-23 : 10:53:01
Kevin writes "[NT Server 4.0 Service pack6 SQL 7.0]
I orginally set this to "sqlguru@4guysfromrolla.com" and Scott set me to you. It seem that I'am struggling with the ASP part.
Any help would be great.

Hello I have a question about using the CONTAINS predicate. I setup a "full-text indexing" on one of the tables (products) I
trying to search. This search is coming by means of a HTML form. I need to set up two variables (search1 & search2) in the select/contains statement. I'm having problems parsing the variables in ASP. In the examples I've read, they demonstrate syntax using -> Example [contains(*,' "variable1" OR "variable2" ')] The "x" value must be placed around the variable to create a string value...especially for values with multiple words. I can't seem to be able to place the quote tags around the variables with out them becoming string before there parsed. How can I accomplish this?
I'm able to create the search statement in SQL Editor with the results I want.
Thank you .....code below is on my page.


<% Set RS = Server.CreateObject("ADODB.RecordSet")
mySQL = "SELECT sku,title,description FROM products WHERE Active = 1 AND" &_
" contains(*,'" & search1 & "')Order by priorityID"
response.write(mySQL)
Set RS = Conn.Execute(mySQL) %>

<% Do While (NOT RS.EOF)%>
<% strContent= RS("description")
strContent = MID(strContent,1, 100) %>

<tr align="left" valign="top">
<td width="65">
<a href="../products/product3_searchresult.asp"><img
src="../products/images/thumb/<%= RS("sku")%>.jpg" width="59" height="59" border="0"></a></td>

<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<a href="../products/product3_searchresult.asp"><%= RS("title")%>  Click for More</a>

<%= strContent %>...</font></td>
</tr>

<% RS.MoveNext %>
<% Loop %>
<% RS.Close %>

Kevin
Gallery Nine Digital Media."
   

- Advertisement -