Поделиться через


Setting the Provider Property

Note

Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.

 

To use the ActiveX Data Objects (ADO) API, a program or script needs to open a connection to the OLE DB Provider for Indexing Service and set the Provider property of the ADO Connection object to the string "MSIDXS". The Provider property can also be set by the contents of the ConnectionString property or the ConnectionString parameter of the Open method. Alternatively, you can generate a Recordset object and ensure that the associated Open method includes a ConnectionString parameter containing the string "PROVIDER=MSIDXS;".

The following is an example of the minimal Microsoft Visual Basic Scripting Edition (VBScript) code needed to generate an ADO Recordset object.

Set rstMain = Server.CreateObject("ADODB.Recordset")
RstMain.Open "SELECT DocAuthor, DocTitle, FileName 
                FROM SCOPE() WHERE size > 50000",
                "PROVIDER=MSIDXS;"

The following is an example of the ADO code that creates a Connection object.

Set Conn = Server.CreateObject ("ADODB.Connection")
Conn.ConnectionString = "provider=msidxs;"
Conn.Open 

After executing the preceding example, you can create a Command object, associate it to the active connection you opened, set the CommandText property of the Command object to the desired SQL query string, and create the associated Recordset object to retrieve the results of your query.