ICategory3::SetRelatedProducts Method [C++]

Use this method to update product relationships.

Definition

[C++]

HRESULT ICategory3::SetRelatedProducts(_Recordset*pRSRelatedProducts);

[Visual Basic]

Sub SetRelatedProducts(pRSRelatedProducts As Recordset)

Parameters

  • pRSRelatedProducts[C++]
    [in] A reference to a _Recordset object that contains the related products.
  • pRSRelatedProducts[Visual Basic]
    A Recordset object that contains the related products.

Return Values

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

[Visual Basic] None.

Error Values

[C++] 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.

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

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_INVALID_OPERATION_FOR_ROOT_CATEGORY

[C++] 0x889800F8

[Visual Basic] &H889800F8

This API cannot be called for a root category.
E_POINTER

[C++] 0x80004003

[Visual Basic] &H80004003

Invalid pointer.
E_CAT_PRODUCT_DOESNT_EXIST

[C++] 0x8898001E

[Visual Basic] &H8898001E

The product you specified doesn't exist.
E_CAT_DEFN_NO_RELATIONSHIP_EXISTS

[C++] 0x88980045

[Visual Basic] &H88980045

The relationship that you specified either does not exist or is a inherited relationship (and therefore cannot be edited).
E_CAT_VC_ERROR_IN_PROPAGATING_BC_CHANGES

[C++] 0x88980101

[Visual Basic] &H88980101

There was an error in propagating the base catalog changes to the dependent virtual catalogs.

Remarks

[C++]

The recordset used for the pRSRelatedProducts parameter should be obtained from the get_RelatedProducts method.

Only the RelationshipDescription field should be updated. Other changes should be made using the RemoveRelationshipToProduct and AddRelationshipToProduct methods.

[Visual Basic]

The recordset used for the pRSRelatedProducts parameter should be obtained from the RelatedProducts property.

Only the RelationshipDescription field should be updated. Other changes should be made using the RemoveRelationshipToProduct and AddRelationshipToProduct methods.

You can update multiple records in the same call to this method.

When calling this method on an inherited category in a virtual catalog, the method will fail.

The input recordset should not contain any rows that are inherited relationships. Such rows must be removed from the recordset first if they exist, as they may be returned by the RelatedProducts method.

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

[Visual Basic]

Example

'pRSRelatedProducts is an existing recordset.
'It was obtained from the RelatedProducts property.

myCategory.SetRelatedProducts(pRSRelatedProducts)

See Also

[C++]Category Object

[Visual Basic]Category Object

[C++]get_RelatedProducts

[Visual Basic]RelatedProducts

[C++]RemoveRelationshipToProduct

[Visual Basic]RemoveRelationshipToProduct

[C++]AddRelationshipToProduct

[Visual Basic]AddRelationshipToProduct

Copyright © 2005 Microsoft Corporation.
All rights reserved.