IContentListFactory::ConstructFromRecordset

Ee784034.c++_off(en-US,CS.10).gifEe784034.vb_on(en-US,CS.10).gif

Use this method to initialize a new ContentListFactory object, and create and initialize a new ContentListSchema object, from an ADO Recordset object.

Definition

HRESULT IContentListFactory::ConstructFromRecordset(_Recordset*Recordset,VARIANTSkip,IContentListSchema*Add);

Parameters

Recordset

[in] A pointer to an ADO Recordset object from which the ContentList object will be constructed.

Skip

[in,optional] A VARIANT that is a SimpleList object. The SimpleList object contains the names of field(s) that exist in the Recordset object but that should not have a column in the new ContentList object.

Add

[in,optional] A pointer to the IContentListSchema interface of a ContentListSchema object that contains information about additional columns or new flags for existing columns that should be accounted for when the new ContentList object is created. Refer to the Remarks section for additional information.

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

The Skip and Add parameters are both optional.

Columns defined in the ContentListSchema object that do not exist in the Recordset object are added to the new schema for the ContentListFactory object. Schema columns defined in both the ContentListSchema object and in the Recordset object get their flag settings from the former object, overriding the default flag settings otherwise applied. Supplemental columns may be either shared or private. Data for any supplemental, shared columns should be initialized using the SetData method. Data for any supplemental, private columns cannot be provided until a corresponding ContentList object is created.

The default value for dwFlags for columns created from the fields of the Recordset object is CLCOL_READONLY.

The ContentListFactory object attempts to access the RecordCount property of the RecordSet to determine how many rows of data for which space should be allocated. Not all types of RecordSets support this. If the RecordCount property cannot be determined, the ContentListFactory object will grow the factory in chunks of 100 rows. For this reason, it is most efficient to pass a RecordSet for which the RecordCount property is defined.

Column types are mapped from the Recordset object according to the following table.

ADO Type ContentList Type
adSmallInt, adUnsignedSmallInt CLCOL_I2
adInteger, adUnsignedInt, adError CLCOL_I4
adSingle CLCOL_I4
adDouble CLCOL_R8
adDBDate, adDBTime, adDBTimeStamp CLCOL_DATE
adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar CLCOL_STRING
adChapter*, adDispatch CLCOL_DISPATCH
adChapter CLCOL_UNKNOWN
adBoolean CLCOL_BOOL

Ee784034.note(en-US,CS.10).gif Note

  • *One level hierarchical Recordset objects are supported. The child Recordset objects are created in the ContentList object as a SimpleList of Dictionary objects.

See Also

ContentListFactory Object


All rights reserved.