IExpressionStore::SaveExpression

Ee784706.c++_off(en-US,CS.10).gifEe784706.vb_on(en-US,CS.10).gif

Use this method to save a new or modified expression to the expression store. For a new expression, the SaveExpression method automatically generates a unique expression ID and stores it with the expression.

Definition

HRESULT IExpressionStore::SaveExpression(_Recordset*pRSExpr);

Parameters

pRSExpr

[in] A pointer to the ADO hierarchical Recordset object that contains the expression.

Return Values

This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.

Error Values

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.

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

Constant Value Description
E_EXPR_BADCONNECTION 0x8110001F Invalid connection
E_EXPR_BADEXPRBODY 0x81100004 Invalid or missing expression body
E_EXPR_BADEXPRCATEGORY 0x8110000A Invalid expression category specified
E_EXPR_BADEXPRNAME 0x81100003 Invalid expression name
E_EXPR_CYCLEDETECTED 0x81100006 A cycle was detected in the expression dependencies of this expression
E_EXPR_DUPEXPRDEPS 0x81100009 Duplicate expression dependency
E_EXPR_DUPEXPRNAME 0x81100007 Duplicate expression name
E_EXPR_DUPPROFDEPS 0x81100008 Duplicate profile dependency
E_EXPR_INVALIDEXPRDEPS 0x8110000B One or more of the expression dependencies refers to an expression ID that does not exist
E_EXPR_INVALIDFIELDSIZE 0x81100005 The new name exceeds the maximum size of 30 characters
E_EXPR_NOCONNECTIONSTRING 0x8110000D No connection string specified
E_EXPR_NOPROFDEPS 0x81100002 Expression must have at least one profile-dependency to be saved

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.

Remarks

If the expression being saved is not currently in the expression store, the SaveExpression method generates a unique identifier and populates the ExprID field of the Recordset object. The identifier is a positive integer. For more information about the format and fields of the Recordset object, see Expression Recordset.

The ExpressionStore object performs rudimentary checks for expression dependencies when an expression is saved or deleted. This includes any direct references, a test for cyclic referencing, and any references to non-existent expressions.

Call the Connect method before calling the SaveExpression method.

See Also

ExpressionStore Object

IExpressionStore::Connect

IExpressionStore::GetExpression

IExpressionStore::NewExpression


All rights reserved.