Microsoft KB Archive/179326

= FILE: Idxadovb.exe: Using Index Server OLE DB Provider and ADO in Visual Basic =

Article ID: 179326

Article Last Modified on 3/14/2005

-

APPLIES TO


 * Microsoft OLE DB Provider for Index Server 2.0
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.7
 * Microsoft ActiveX Data Objects 1.5
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q179326



SUMMARY
The Idxadovb.exe sample demonstrates how to use an ActiveX Data Objects (ADO) recordset with the OLE DB Provider for Index Server (MSIDXS) in a Visual Basic application to query Index Server 2.0.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Idxadovb.exe

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.

Using the Sample File
This sample lets a user specify a query string, scope, and sort order. The sample shows the filename, path, size and last write-time for all documents in the result set. Results can be sorted by rank (default), filename, path, size or write-time based on the current selection in Sort dialog box.

The following code opens an ADO recordset and submits a query to the Index Server using the OLE DB provider: Dim RS As New ADODB.Recordset Const adOpenForwardOnly = 0 Connect = "provider=msidxs" CommandText = "SELECT Filename, Path, Size, Write FROM Scope('" +  Chr(34) + Scope.Text + Chr(34) + "') WHERE " + QueryText.Text + "   ORDER BY " + Sort.Text

' Print SQL text in debug window. Debug.Print CommandText RS.Open CommandText, Connect, adOpenForwardOnly Run the sample and type the query in the Query text box. Select a scope (the folder containing the documents to search) and click GO. Either the search results will be displayed or the "No matches found..." message. The sample also prints the current SQL statement sent by the application in the debug (immediate) window in Visual Basic 5.0 IDE.

