Share via


IExpressionStore::Query Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

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.

HRESULT IExpressionStore::Query(
  VARIANT vName,
  VARIANT vCategory,
  VARIANT vProfiles,
  _Recordset** ppRSExprs
);
Function Query(
  Optional vName 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.

    [Visual Basic]

    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.

    [Visual Basic]

    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.

    [Visual Basic]

    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 Value

[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

0x8110001F

&H8110001F

Invalid connection

E_EXPR_NOCONNECTIONSTRING

0x8110000D

&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".

For details on the ADO Recordset object that represents the expression, see Expression Recordset.

Call the Connect method before calling the Query method.

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

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

Other Resources

ExpressionStore Object

IExpressionStore::Connect Method