Freigeben über


Creating a Recordset Object with the ADO API

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.

 

This code segment executes when the specified query language is the SQL query language. It sets several parameters and then uses the CreateObject function to create RS, a Recordset object to represent the results of the query. It then executes the query using the Open method of the RS Recordset object.

...
        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
...
        Set RS = CreateObject("ADODB.Recordset")
        RS.Open CommandText, Connect, adOpenForwardOnly
...