Share via


CatalogManager.CreateProperty

Ee798781.c++_on(en-US,CS.10).gifEe798781.vb_off(en-US,CS.10).gif

Use this method to create a new property.

Definition

Function CreateProperty(strPropertyName As String,eDataType As CatalogDataTypeEnum,Optional varMaxLength As Variant) As _Recordset

Parameters

strPropertyName

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

eDataType

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

varMaxLength

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.

Return Values

If this method completes successfully, it returns a Recordset object that contains the property attributes.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM 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 &H88980003 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. In particular, the Description property may contain a text description of the error.

Remarks

The recordset returned by this property is valid only if it is 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.

Example

'varMaxLength is a Variant
'cscString is an enum of type cscEnumeration
varMaxLength = 128
Set rsNewPropAttribs = myCatalogManager.CreateProperty("Format", cscString, varMaxLength)

See Also

CatalogManager Object

CatalogManager.DeleteProperty

CatalogManager.GetPropertyAttributes

CatalogManager.SetPropertyAttributes


All rights reserved.