IExpressionStore::GetExprID Method [C++]

Use this method to translate the name of an expression into its corresponding expression ID.

Definition

[C++]

HRESULT IExpressionStore::GetExprID(BSTRstrExprName,
 long*pnExprID);

[Visual Basic]

Function GetExprID(strExprName As String) As Long

Parameters

  • strExprName[C++]
    [in] A BSTR that contains the expression name.
  • strExprName[Visual Basic]
    [in] A String that contains the expression name.
  • pnExprID[C++]
    [out, retval] A pointer to a long that contains the expression ID. On failure, the expression ID is set to EXPRID_INVALID (defined as -1).

Return Values

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

[Visual Basic] If this method completes successfully, it returns a Long that contains the expression ID. On failure, the expression ID is set to EXPRID_INVALID (defined as -1).

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_BADEXPRNAME

[C++] 0x81100003

[Visual Basic] &H81100003

Invalid expression name, or expression name not found in store
E_EXPR_NOCONNECTIONSTRING

[C++] 0x8110000D

[Visual Basic] &H8110000D

No connection string specified

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

Use the GetExprName method to translate the ID of an expression into its corresponding expression name.

Call the Connect method before calling the GetExprID method.

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

[C++]

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

[Visual Basic]

Example

' lExpressionID is a long
' oExpressionStore is an ExpressionStore object connected to
' a valid expression store.

lExpressionID = oExpressionStore.GetExprID("MyExpression")

See Also

[C++]ExpressionStore Object

[C++]IExpressionStore::Connect

[C++]IExpressionStore::GetExpression

[C++]IExpressionStore::GetExprName

[C++]IExpressionStore::RenameExpression

[Visual Basic]ExpressionStore Object

[Visual Basic]ExpressionStore.Connect

[Visual Basic]ExpressionStore.GetExpression

[Visual Basic]ExpressionStore.GetExprName

[Visual Basic]ExpressionStore.RenameExpression

Copyright © 2005 Microsoft Corporation.
All rights reserved.