ExpressionEval.Connect

Ee798407.c++_on(en-US,CS.10).gifEe798407.vb_off(en-US,CS.10).gif

Use this method to establish communication with an expression store.

Definition

Sub Connect(vConnectInfo As Variant)

Parameters

vConnectInfo

[in] A Variant that describes the expression store connection information. This may be a String containing the connection information or a reference to an existing ExpressionStore object.

Return Values

None.

Error Values

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 &H8110001F Invalid connection
E_EXPR_BADEXPRSTORE &H8110001E Specified database does not contain a valid expression store
E_EXPR_NOCONNECTIONSTRING &H8110000D No connection string specified
E_EXPR_STOREPERMISSIONS &H8110000F Insufficient access permissions on the expression store database

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 a connection string is passed as the input parameter, the ExpressionEval object creates an ExpressionStore object that uses the connection string to access the expression store. Upon destruction, the ExpressionEval object destroys the ExpressionStore object.

The connection string for the expression store may be obtained through the SiteConfigReadOnly object or through the Commerce Server Manager console from the s_BizDataStoreConnectionString property under the key "Commerce Server Manager\Global Resources\Profiles".

The Connect method must be used before loading or evaluating expressions.

The ParseXML method and the flush methods may be used without connecting to an expression store.

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

Example

' Connect through an existing ExpressionStore object.

oExpressionEval.Connect oExpressionStore

' Connect using an explicit connection string.

oExpressionEval.Connect "Provider=SQLOLEDB;Data Source=server;" _
& "Initial Catalog=Retail_commerce;User ID=userID;Password=psswrd"

' Connect using a string retrieved from the SiteConfigReadOnly object.
' sConn is a String, oSCRO is an initialized SiteConfigReadOnly object.

sConn = oSCRO.Fields("Biz Data Service").Value _
 .Fields("s_BizDataStoreConnectionString").Value
oExpressionEval.Connect sConn

See Also

ExpressionEval Object

ExpressionStore Object

ExpressionStore.Connect

SiteConfigReadOnly Object


All rights reserved.