ISearchQueryHelper::get_ConnectionString Method

Returns the OLE DB connection string for the Window Search index.


HRESULT get_ConnectionString(      
    LPWSTR *pwszConnectionString


  • pwszConnectionString
    [out, retval] Receives a pointer to a null-terminated Unicode string that is a valid OLE DB connection string. This connection string can be used to initialize a connection to the Windows Search index and submit the Structured Query Language (SQL) query returned by ISearchQueryHelper::GenerateSQLFromUserQuery.

Return Value

Returns S_OK if successful, or an error value otherwise.


A connection string is a string version of the initialization properties needed to connect to a data store. The string can include such things as a data source, data source name, or user ID and password.

The DSearch code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to create a class for a static console application to query Windows Search using the Microsoft.Search.Interop assembly for ISearchQueryHelper.