IExpressionStore::Query Method [C++]

Use this method to retrieve a Recordset object containing expressions that match the specified query conditions. At least one of the optional arguments must be specified.

Definition

[C++]

HRESULT IExpressionStore::Query(VARIANTvName,
 VARIANTvCategory,
 VARIANTvProfiles,
 _Recordset**ppRSExprs);

[Visual Basic]

Function Query(OptionalvName As Variant,
 Optional vCategory As Variant,
 Optional vProfiles As Variant) As Object

Parameters

  • vName[C++]
    [in, optional] When specified, a BSTR name to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vName[Visual Basic]
    [in, optional] When specified, a String name to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vCategory[C++]
    [in, optional] When specified, a BSTR containing the category or SAFEARRAY of category strings to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vCategory[Visual Basic]
    [in, optional] When specified, a String containing the category or SAFEARRAY of category strings to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vProfiles[C++]
    [in, optional] When specified, a BSTR containing the profile name or SAFEARRAY of profile names to match expressions against. Profile names must be specified without wildcards.
  • vProfiles[Visual Basic]
    [in, optional] When specified, a String containing the profile name or SAFEARRAY of profile names to match expressions against. Profile names must be specified without wildcards.
  • ppRSExprs[C++]
    [out, retval] An address of a pointer to a Recordset object that contains the result set of expressions. On failure, the pointer to the Recordset object will be set to NULL.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] This method returns an ADO hierarchical Recordset object. If successful, the Recordset object contains the result set of expressions. If unsuccessful, the Recordset object is set to Nothing.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_EXPR_BADCONNECTION

[C++] 0x8110001F

[Visual Basic] &H8110001F

Invalid connection
E_EXPR_NOCONNECTIONSTRING

[C++] 0x8110000D

[Visual Basic] &H8110000D

No connection string specified

Remarks

If a combination of the optional parameters is specified, the retrieved expressions satisfy all constraints (implicit AND applied). For example, if name = "Robert%" and category = "General", only expressions with names starting with "Robert" and with a category of "General" will be returned.

When multiple profile names are specified, the query result includes expressions with profile requirements (dependencies) that include any of the listed profile names (implicit OR applied). Thus, if name = "Robert%" and the profiles "User" and "Context" are specified as profiles, the Query method will return all expressions with names starting with "Robert" and profiles requiring only "User", only "Context", or both "User" and "Context".

[C++] For details on the ADO Recordset object that represents the expression, see Expression Recordset.

[Visual Basic] For details on the ADO Recordset object that represents the expression, see Expression Recordset.

Call the Connect method before calling the Query method.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[C++]

The ppRSExprs parameter contains valid data only if the method completes successfully.

[Visual Basic]

Example

' oExpressionStore is an ExpressionStore object connected to
' a valid expression store.
' rsExpr is a Recordset object that will contain all expressions
' with a name starting with 'Express', having a category of
' Octogenarians' and a profile dependency on 'joeuser'.

rsExpr = oExpressionStore.Query("Express%", "Octogenarians", "joeuser")

See Also

[C++]ExpressionStore Object

[C++]IExpressionStore::Connect

[Visual Basic]ExpressionStore Object

[Visual Basic]ExpressionStore.Connect

Copyright © 2005 Microsoft Corporation.
All rights reserved.