IProduct::SetVariantProperties

Ee798808.c++_off(en-US,CS.10).gifEe798808.vb_on(en-US,CS.10).gif

Use this method to set the properties for a variant of this product.

Definition

HRESULT IProduct::SetVariantProperties(_Recordset*pRSNewState,VARIANTfForceUpdate);

Parameters

pRSNewState

[in] A pointer to a Recordset object that contains the new product variant properties. This should be a recordset returned by the GetVariantProperties property, or by the CreateVariant method.

fForceUpdate

[in, optional] A VARIANT that determines whether to force an update of the product variant properties.

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_CATALOG_DOESNT_SUPPORT_VARIANTS 0x88980032 Catalog does not support variants.
E_CAT_INVALIDVALUE_FOR_PROPERTY 0x88980038 An invalid value was specified for one of the product properties. This error was returned if:
  • One of the properties did not satisfy the Min/Max condition.

  • The properties of string or enumeration data type exceeded the maximum length.

  • The value of the enumeration property was not one of the legal values defined.
E_CAT_PRODUCT_CHANGED 0x88980027 This product's properties were changed since they were last read. This error is returned only if the fForceUpdate parameter is set to False.
E_CAT_VARIANT_DOESNT_EXIST 0x8898001F This product variant has been removed from the catalog.

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

Use the SetVariantProperties method to modify the properties of a product variant. The pRSNewState parameter specifies a Recordset object that describes the new property values for this product variant. Use the recordset returned by the GetVariantProperties property, or by the CreateVariant method, so that timestamps can be compared for error detection.

If the fForceUpdate parameter is set to False, and the property values in the*****pRSNewState* parameter have changed, the method will fail.

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

See Also

Product Object

IProduct::GetVariantProperties


All rights reserved.