Code to Connect to the Profiles Store

This section shows how to connect to the Profile Store. A SiteConfigReadOnly object provides access to the connection string. For more information about the connection string, see ProfileService.Initialize.

  1. Create a SiteConfigReadOnly object and initialize it for the "Retail" site.

    Dim oSiteConfigReadOnly
    Set oSiteConfigReadOnly = Server.CreateObject _
     ("Commerce.SiteConfigReadOnly")
    oSiteConfigReadOnly.Initialize "Retail"
    
  2. Retrieve the connection string to the Profile Store and release the SiteConfigReadOnly object.

    Dim sBDSConnect
    sBDSConnect = oSiteConfigReadOnly.Fields("Biz Data Service") _
     .Value.Fields("s_ProfileServiceConnectionString").Value
    
    Set oSiteConfigReadOnly = Nothing
    
  3. Create the ProfileService object and connect to the Profile Store. The Profile Definitions parameter is the catalog used for the profile schema definitions.

    Dim oProfileService
    Set oProfileService = Server.CreateObject("Commerce.ProfileService")
    oProfileService.Initialize sBDSConnect, "Profile Definitions"
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.