Ssadovb.exe Demonstrates Using OLEDB & ADO in Visual Basic (184385)



The information in this article applies to:

  • Microsoft OLE DB Provider for Site Server 3.0
  • ActiveX Data Objects (ADO) 1.5
  • Microsoft Data Access Components 2.1 SP2

This article was previously published under Q184385

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 Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Sample File Information

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.

Modification Type:MinorLast Reviewed:8/9/2004
Keywords:kbdownload kbfile kbinfo KB184385 kbAudDeveloper