ExpressionStore.Connect Method (PIA)

Use this method to store the connection string to an expression store.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Sub Connect(strConnStr As String)

[C#]

using Microsoft.CommerceServer.Interop.Targeting;
…
public void Connect(stringstrConnStr);

Parameters

[Visual Basic .NET]

  • strConnStr
    A String that contains the database connection information for the expression store.

[C#]

  • strConnStr
    A string that contains the database connection information for the expression store.

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

[C#]

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

Value Description
0x8110001F Invalid connection
0x8110001E Specified database does not contain a valid expression store
0x8110000D No connection string specified
0x8110000F Insufficient access permissions on the expression store database

Remarks

The ExpressionStore object does not maintain a persistent ADO connection. This method stores the connection string after validating that the connection string points to an actual expression store. The Disconnect method sets the connection string to an empty string.

Each method of the ExpressionStore object creates a connection when needed, and when finished closes the connection. This relies on ADO connection pooling and provides higher availability.

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

The Connect method must be successfully executed before calling any other method of an externally created ExpressionStore object.

[Visual Basic .NET]

Example

' Connect using an explicit connection string .
' oExpressionStore is a valid ExpressionStore object

oExpressionStore.Connect ("Provider=SQLOLEDB;Data Source=server;" _
& "Initial Catalog=Retail_commerce;Integrated Security='SSPI'")

' 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 
oExpressionStore.Connect (sConn)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Targeting

Platforms: Windows 2000, Windows Server 2003

Assembly: exprarchlib (in exprarchlib)

See Also

ExpressionStore Class

ExpressionStore.Disconnect

SiteConfigReadOnly Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.