IMSCSDBStorage_3_0::InitStorage

Ee784277.c++_off(en-US,CS.10).gifEe784277.vb_on(en-US,CS.10).gif

Use this method to initialize the DBStorage object. You must call this method immediately after object creation and before calling any other object methods. Attempting to call any other method prior to calling the InitStorage method results in an error.

Definition

HRESULT IMSCSDBStorage_3_0::InitStorage(VARIANTvtDataSourceOrDSN,BSTRTable,BSTRbstrKey,VARIANTvtProgID,VARIANTvtMarshal,VARIANTvtChanged);

Parameters

vtDataSourceOrDSN

[in] A VARIANT which references a valid IDispatch pointer on a DataSource object, or which references a data source name (DSN).

Table

[in] A BSTR that contains the name of the table within the data source in which to maintain the data.

bstrKey

[in] A BSTR that contains the column name that the DBStorage object uses as a key into the database table. This column should be marked to contain unique values.

vtProgID

[in] A VARIANT that contains the ProgID of the object in which data passed to or retrieved by DBStorage methods will be stored. This parameter can be Commerce.Dictionary for storing Dictionary objects or Commerce.OrderForm for storing OrderForm objects. Methods (such as GetData) that return data from the database create an instance of the specified class with the requested data stored within it.

vtMarshal

[in] A VARIANT that contains the text string that, if specified, indicates the name of a column in the database into which the CommitData or InsertData method will store all the data from the specified data object, serialized into an encoded binary format. (Objects in the stored item that have corresponding column names in the database are also stored in those columns in the database.) If this argument is specified, the database must contain a column by that name, or an error will result. If this argument is not specified, then no data from the object is serialized and saved in the database in binary format, and items in the object that do not have corresponding columns in the database are discarded. When using a Microsoft SQL Server database, the maximum size of the data in this column is the same as the maximum size for the SQL Server text/image data type (2,147,483,647 bytes).

vtChanged

[in] A VARIANT that contains the name of a key or attribute in the database into which to write the date when the data is changed. (If you do not specify a column name that exists in the database, the change date will be included in the marshaled data.)

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 standard COM HRESULT 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, 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

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

See Also

DBStorage Object


All rights reserved.