ExpressionStore.Query Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Targeting
Imports ADODB26Lib     ‘ for _Recordset
…
Public Function Query(OptionalvName As Object,
 Optional vCategory As Object,
 Optional vProfiles As Object) As _Recordset

[C#]

using Microsoft.CommerceServer.Interop.Targeting;
using ADODB26Lib;                              //For _Recordset
…
public _Recordset Query(objectvName,
 objectvCategory,
 objectvProfiles);

Parameters

[Visual Basic .NET]

  • vName
    An optional String named to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vCategory
    When specified, a String containing the category or System.Array of category strings to match expressions against. This is used in an SQL LIKE clause that permits wildcards.
  • vProfiles
    When specified, a String containing the profile name or System.Array of profile names to match expressions against. Profile names must be specified without wildcards.

[C#]

  • vName
    When specified, a string name to match expressions against. This is used in an SQL LIKE clause that permits wildcards. Set to Type.Missing in order to not specify a name to match against.
  • vCategory
    When specified, a string containing the category or System.Array of category strings to match expressions against. This is used in an SQL LIKE clause that permits wildcards. Set to Type.Missing in order to not specify a category to match against.
  • vProfiles
    When specified, a string containing the profile name or System.Array of profile names to match expressions against. Profile names must be specified without wildcards. Set to Type.Missing in order to not specify a profile name to match against.

Return Values

[Visual Basic .NET] This method returns the _Recordset interface of a Recordset object. If successful, the Recordset object contains the result set of expressions. If unsuccessful, the Recordset object is set to Null.

[C#] This method returns a _Recordset interface to a Recordset object that contains the result set of expressions. On failure, the pointer to the Recordset object will be set to null.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

[Visual Basic .NET]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
&H8110001F Invalid connection
&H8110000D No connection string specified

[C#]

The following table shows the custom COM errors that COMException can wrap.

Value Description
0x8110001F Invalid connection
0x8110000D 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.

[Visual Basic .NET]

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")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Targeting

Platforms: Windows 2000, Windows Server 2003

Assembly: exprarchlib (in exprarchlib)

See Also

ExpressionStore Class

ExpressionStore.Connect

Copyright © 2005 Microsoft Corporation.
All rights reserved.