GenID.Initialize

Ee799730.c++_on(en-US,CS.10).gifEe799730.vb_off(en-US,CS.10).gif

Use this method to connect the GenID object to the database that stores the table of counters.

Definition

Sub Initialize(bstrDBConnectionString As String,Optional cBlockSizeHint As Long)

Parameters

bstrDBConnectionString

A String that contains the connection information to the database.

cBlockSizeHint

Not implemented, leave blank.

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 standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

This method must be called before calling the GetCounterValue and InitializeCounter methods.

The connection string may be obtained through the SiteConfigReadOnly object or through the Commerce Server Manager console from the connstr_db_Transactions property under Commerce Server Manager\Commerce Sites\<site name>\Site Resources\Transactions.

Example

' oGenID``is a Commerce GenID object

' Connect using an explicit connection string.

oGenID.Initialize "Provider=SQLOLEDB;Data Source=server;" _
 & "User ID=user;Password=psswrd;Initial Catalog=Retail_commerce"

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

sConn = oSCRO.Fields("Transactions").Value.Fields("connstr_db_Transactions").Value
oGenID.Initialize sConn

See Also

GenID Object


All rights reserved.