IExpressionStore::SaveExpression Method
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
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.
HRESULT IExpressionStore::SaveExpression(
_Recordset* pRSExpr
);
Sub SaveExpression(
pRSExpr As Object
)
Parameters
pRSExpr
[C++][in] A pointer to the ADO hierarchical Recordset object that contains the expression.
[Visual Basic]
A Recordset object that contains the expression.
Return Value
[C++]
This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.
[Visual Basic]
None.
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_BADEXPRBODY |
0x81100004 &H81100004 |
Invalid or missing expression body |
E_EXPR_BADEXPRCATEGORY |
0x8110000A &H8110000A |
Invalid expression category specified |
E_EXPR_BADEXPRNAME |
0x81100003 &H81100003 |
Invalid expression name |
E_EXPR_CYCLEDETECTED |
0x81100006 &H81100006 |
A cycle was detected in the expression dependencies of this expression |
E_EXPR_DUPEXPRDEPS |
0x81100009 &H81100009 |
Duplicate expression dependency |
E_EXPR_DUPEXPRNAME |
0x81100007 &H81100007 |
Duplicate expression name |
E_EXPR_DUPPROFDEPS |
0x81100008 &H81100008 |
Duplicate profile dependency |
E_EXPR_INVALIDEXPRDEPS |
0x8110000B &H8110000B |
One or more of the expression dependencies refers to an expression ID that does not exist |
E_EXPR_INVALIDFIELDSIZE |
0x81100005 &H81100005 |
The new name exceeds the maximum size of 30 characters |
E_EXPR_NOCONNECTIONSTRING |
0x8110000D &H8110000D |
No connection string specified |
E_EXPR_NOPROFDEPS |
0x81100002 &H81100002 |
Expression must have at least one profile-dependency to be saved |
[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
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
Other Resources
IExpressionStore::Connect Method