_Catalogsets2::CreateCatalogSet Method [C++]

Use this method to create a new catalog set in the catalog database.

Definition

[C++]

HRESULT _Catalogsets2::CreateCatalogSet(BSTRCatalogSetName,
  BSTRCatalogSetDescription,
  VARIANT_BOOLbWildCard,
  _Recordset*CatalogNamesRS,
  BSTR*CatalogSetID);

[Visual Basic]

Function CreateCatalogSet(CatalogSetName As String,
  CatalogSetDescription As String,
  bWildCard As Boolean,
  Optional CatalogNamesRS As _Recordset) As String

Parameters

[C++]

  • CatalogSetName
    [in] A BSTR that contains a name for the new catalog set. The maximum length is 128 characters.
  • CatalogSetDescription
    [in] A BSTR that contains a description of the new catalog set.
  • bWildCard
    [in] A VARIANT_BOOL that indicates whether this catalog set should automatically include all catalogs, including any new catalogs that might be created in the future. A value of True indicates that this catalog set includes all existing catalogs. A value of False indicates that this catalog set only includes a specific set of catalogs.
  • CatalogNamesRS
    [in, optional] A pointer to an ADO _Recordset object that specifies the catalogs to be included in the new catalog set. The _Recordset object should contain a single column named CatalogName, and one row per catalog to be included. If the bWildCard parameter is True, then this parameter will be ignored.
  • CatalogSetID
    [out, retval] A pointer to a BSTR used to return the automatically generated ID (GUID) of the new catalog set.

[Visual Basic]

  • CatalogSetName
    A String that contains a name for the new catalog set. The maximum length is 128 characters.
  • CatalogSetDescription
    A String that contains a description of the new catalog set.
  • bWildCard
    A Boolean that indicates whether this catalog set should automatically include all catalogs, including any new catalogs that might be created in the future. A value of True indicates that this catalog set includes all existing catalogs. A value of False indicates that this catalog set only includes a specific set of catalogs.
  • CatalogNamesRS
    A reference to an ADO Recordset object that specifies the catalogs to be included in the new catalog set. The Recordset object should contain a single column named CatalogName, and one row per catalog to be included. If the bWildCard parameter is True, then this parameter will be ignored.

Return Values

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

[Visual Basic] If this method completes successfully, it returns a String that contains the ID of the new catalog set.

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.

Remarks

[C++]

The CatalogSetID parameter contains valid data only if the new catalog set was created successfully.

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

[Visual Basic]

The returned String contains a valid ID only if the new catalog set was created successfully.

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

[Visual Basic]

Example

'The following example shows the creation of a catalog set 
'associated with all the catalogs in the Product Catalog System.
strCatalogSetID = myCatalogsets2.CreateCatalogSet("PremiumCatalogs", "Premium catalog set", TRUE)

'The following example shows the creation of a catalog set 
'associated with two specific catalogs.
set rsCatalogNames = CreateObject("ADODB Recordset")
call rsCatalogNames.Fields.Append("CatalogName", adBSTR)
rsCatalogNames.Open
rsCatalogNames.AddNew
rsCatalogNames.Fields("CatalogName").value = "Catalog1"
rsCatalogNames.Update
rsCatalogNames.AddNew
rsCatalogNames.Fields("CatalogName").value = "Catalog2"
rsCatalogNames.Update

strCatalogSetID = myCatalogsets2.CreateCatalogSet("CombinedCatalog", "A one and a two", FALSE, rsCatalogNames)

See Also

[C++]Catalogsets2 Object

[Visual Basic]Catalogsets2 Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.