SAMPLE: Ssadovb.exe Demonstrates Using OLEDB & ADO in VB

ID: Q184385

The information in this article applies to:

SUMMARY

Ssadovb.exe is a sample file that demonstrates how to use an ActiveX Data Objects (ADO) Recordset with the OLE DB Provider for Site Server (MSSearchSQL) in a Visual Basic application to query Web site data.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

~ Ssadovb.exe

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

The sample lets a user specify a query string, scope and sort order. The sample shows the filename, path and the last write-time for all documents in the result set. You may also sort the results by rank (default), filename, path or write-time based on the current selection in the Sort box.

The following code opens an ADO Recordset and submits a query to the Site Server using the OLE DB provider:

   Dim RS As New ADODB.Recordset

           Const adOpenForwardOnly = 0
           Connect = "provider=MSSEARCHSQL;data source=KMSampleCatalog1;"
    CommandText = "SELECT Filename, Path, Write FROM Scope('" + Chr(34) +
    Scope.Text + Chr(34) + "') WHERE " + QueryText.Text + " ORDER BY " +
    Sort.Text

        ' Print SQL text in the debug window.
           Debug.Print CommandText
           RS.Open CommandText, Connect, adOpenForwardOnly


Run the sample and type the query in the Query text box. Click the Go command button. Either the search results display or the following message appears:

   No matches found...

The sample also prints the current SQL statement sent by the application in the debug (immediate) window in Visual Basic 5.0 IDE.

To make sure the catalog is ready for the search, run the Site Server Admin tool using the following steps:

1. Go to the Programs\Microsoft Site Server\Administration\Site Server

   Service Admin (MMC) folder.

2. Expand the Search folder and select a catalog from the "Catalog Build
   Server" folder.

3. Use the Task/Start build shortcut menu to build the catalog.

4. Go to the Search Server folder and use the Task/Update shortcut menu to

   update the search catalogs.

5. Use the catalog name in your ADO connection string's data source
   property as shown in the code example above.


Additional query words: adovb
Technology        : ole
Version           : WINDOWS:1.5,2.0
Platform          : WINDOWS
Issue type        : kbinfo

Last Reviewed: May 4, 1998