CatalogManager3.CreateProperty Method (PIA)

Use this method to create a new property.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
Imports ADODB26Lib     ‘ for _Recordset
…
Public Function CreateProperty(strPropertyName As String,
  eDataType As CatalogDataTypeEnum,
  Optional varMaxLength As Object) As _Recordset

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
using ADODB26Lib;                              //For _Recordset
…
public _Recordset CreateProperty(stringstrPropertyName,
  CatalogDataTypeEnumeDataType,
  objectvarMaxLength);

Parameters

[Visual Basic .NET]

  • 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
    An Object 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.

[C#]

  • 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
    An object 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. Specify no maximum length by setting this to Type.Missing.

Return Values

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

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The following table shows the custom COM errors that a COMException can wrap.

Name Value Description
E_CAT_CATMGR_NOT_INITIALIZED

[C#] 0x889800B5

[Visual Basic .NET] &H889800B5

The CatalogManager object has not been initialized. The CatalogManager object should be initialized before calling this method.
E_CAT_INVALID_PROPERTY_NAME

[C#] 0x889800A2

[Visual Basic .NET] &H889800A2

The PropertyName you specified is invalid. property Names cannot be blank and cannot exceed 100 characters. property names cannot begin with a digit and cannot contain one of the following five reserved characters .,"[]
E_CAT_INVALID_DATATYPE

[C#] 0x88980074

[Visual Basic .NET] &H88980074

The datatype you specified is invalid.
E_CAT_INVALID_PARAMETER

[C#] 0x889800B6

[Visual Basic .NET] &H889800B6

The input parameter <parameter number> is invalid.
E_CAT_INVALID_COLUMN_LENGTH

[C#] 0x88980040

[Visual Basic .NET] &H88980040

The length specified for this property does not lie between 1 and 4000.
E_CAT_INVALID_DATATYPE_FOR_ATTRIBUTE

[C#] 0x889800A6

[Visual Basic .NET] &H889800A6

The enumeration or filename data types cannot be used for creating property attributes.
E_CAT_INBUILT_PROPERTY

[C#] 0x8898003E

[Visual Basic .NET] &H8898003E

The property name you specified is used as a Catalog Management Inbuilt property name.
E_CAT_PROP_EXISTS

[C#] 0x88980003

[Visual Basic .NET] &H88980003

The property name you specified already exists.

Remarks

[Visual Basic .NET]

The recordset returned by this property is valid only if it is accessed successfully.

This method returns the _Recordset interface to 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, and shows 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.

[C#]

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, and shows 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.

[Visual Basic .NET]

Example

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

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

CatalogManager3 Class

CatalogManager3.DeleteProperty

CatalogManager3.GetPropertyAttributes

CatalogManager3.SetPropertyAttributes

Copyright © 2005 Microsoft Corporation.
All rights reserved.