Microsoft KB Archive/243724

= An Example Search Results Page Utilizing a SQL-Style Query for Site Server Search =

Article ID: 243724

Article Last Modified on 2/3/2000

-

APPLIES TO


 * MSN Search, when used with:
 * Microsoft Site Server 3.0 Standard Edition

-



This article was previously published under Q243724



SUMMARY
A basic search results page utilizing an SQL-style query for Site Server Search can be constructed in relatively few lines of code. The code presented in this article is a commented example of such a page.



MORE INFORMATION
<%@ Language="VBScript" %>   <% ' Create and set up the connection to Search. Set objConn = Server.CreateObject ("ADODB.Connection") objConn.ConnectionString = "provider=mssearchsql;" objConn.Open

' Create and set up the Command object. Set objCmd = Server.CreateObject("ADODB.Command") Set objCmd.ActiveConnection = objConn

' Build the SQL Statement. strSQLText = "SELECT Title, DocAddress, Description, Rank" & _ " FROM ..Scope" & _ " WHERE Contains('')" & _ " ORDER BY Rank DESC, Title"

' Set and execute the query entered by the user. objCmd.CommandText = strSQLText Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open objCmd

' Display the results. Response.Write objRS.Properties ("RowCount") & " documents match the query" Response.Write " "

' Clean up after ourselves by closing our recordset and setting our objects equal to Nothing objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing %>  

Keywords: kbhowto KB243724

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.