ICatalogManager::CreateProperty

Ee798783.c++_off(en-US,CS.10).gifEe798783.vb_on(en-US,CS.10).gif

Use this method to create a new property.

Definition

HRESULT ICatalogManager::CreateProperty(BSTRstrPropertyName,CatalogDataTypeEnumeDataType,VARIANTvarMaxLength,_Recordset**ppRSProperty);

Parameters

strPropertyName

[in] A BSTR that contains the name of the new property. This parameter can only contain characters that are acceptable in XML tags.

eDataType

[in] An enumeration value that specifies the data type of the new property. See the Remarks section for valid values.

varMaxLength

[in, optional] A VARIANT that contains the maximum length for the property. Even though this parameter is an optional value it must be given if the data type of the property is cscString. Properties of data type cscEnumeration have a fixed default value of 128, which cannot be changed. Properties of data type cscFilePath have a fixed default value of 256, which cannot be changed.

ppRSProperty

[out, retval] A pointer used to return a Recordset object that will contain the new property.

Return Values

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT 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_CAT_PROP_EXISTS 0x88980003 The specified property name already existed. Property names must be unique across the Product Catalog System.

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 ppRSProperty parameter contains valid data only if the property was accessed successfully.

This method returns a single row Recordset object containing the newly created property. For more information about the fields in this Recordset object, see PropertyAttribute Recordset.

The following table shows the values of the CatalogDataTypeEnum enumeration, their associated names, and describes their use.

Name Value Description
cscInteger 0 Indicates an exact numeric value that holds whole numbers from –2[31] (-2,147,483,648) <= n <= 2[31] –1 (2,147,483,647)
cscBigInteger 1 Indicates an exact numeric value with precision 19 (if signed) or 20 (if unsigned) and scale 0 (signed: –2[63] <= n <= 2[63] – 1, unsigned:  0 <= n <= 2[64] – 1) [3], [9].
cscFloat 2 Indicates a positive or negative floating-point number. The range of positive values is approximately 2.23E –308 through 1.79E 308 and the range of negative values is approximately  –2.23E –308 through –1.79E 308.
cscDouble 3 Indicates a positive or negative floating-point number. The range of positive values is approximately 2.23E –308 through 1.79E 308 and the range of negative values is approximately –2.23E –308 through –1.79E 308.
cscBoolean 4 Indicates a Boolean (bit), holds either a 1 or 0. Integer values other than 1 or 0 are accepted but are always interpreted as 1.
cscString 5 Indicates a variable-length character string with a maximum string length of 255 characters.
cscDateTime 6 Indicates a Microsoft SQL Server DateTime data type.
cscCurrency 7 Indicates a Microsoft SQL Server Money data type.
cscFilePath 8 Indicates a String that holds a file path.
cscEnumeration 9 Indicates an Integer associated with a defined constant.
cscInvalid -1 Reserved for future use.

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

See Also

CatalogManager Object

ICatalogManager::DeleteProperty

ICatalogManager::GetPropertyAttributes

ICatalogManager::SetPropertyAttributes


All rights reserved.