IProductCatalog::DeleteProduct
Use this method to delete a product from the Product Catalog System.
Definition
HRESULT IProductCatalog::DeleteProduct(VARIANTvarProductID);
Parameters
varProductID
[in] A VARIANT that contains the unique identifier of the product to be deleted.
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 error that this method can return.
Constant | Value | Description |
E_CAT_CATALOG_DOESNT_EXIST | 0x88980002 | The catalog did not exist. |
E_CAT_PRODUCT_DOESNT_EXIST | 0x88980010 | The specified product did not exist. |
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
This method removes the product from the SQL Server database. The Product object caches information for improved performance. Because of this cache, the CatalogName and ProductID methods of the Product object will continue to return the old values after the DeleteProduct method has been called. The Variants, ParentCategories, AncestorCategories, RelatedCategories, and RelatedProducts properties will return an empty recordset and no error message.
Caution
- Deleting a product with variants also deletes all of the variants.