Code to Create an Order

The following Active Server Pages (ASP) code creates an OrderForm object, an OrderGroup object, and an OrderGroupManager object. All of these objects are required in order to manipulate orders. Many of the default fields are not added to the Orderform object until the pipeline has been run, thus the order form that this code creates is an empty order form.

  1. Create the OrderGroupManager, OrderGroup, and OrderForm objects.

    Dim oOrderForm, oOrderGroup, oOGMgr, sUserID
    Set oOrderForm = Server.CreateObject("Commerce.OrderForm")
    Set oOrderGroup = Server.CreateObject("Commerce.OrderGroup")
    Set oOGMgr = Server.CreateObject("Commerce.OrderGroupManager")
    
  2. Initialize the OrderGroup and OrderGroupManager objects. Note that in the following example, the connection strings have been formatted for better display.

    sUserID = "AAAABB4C-C33E-11D0-B8A0-A0C04FB616C7"
    
    oOrderGroup.Initialize "Provider=SQLOLEDB.1;
                                          Integrated Security='SSPI';
                                  InitialCatalog=""Retail_commerce"";
                                                DataSource=TESTMACH2;
                                           Network Library=dbmssocn",
                                                              sUserID
    
    oOGMgr.Initialize "Provider=SQLOLEDB.1;
                                     Integrated Security='SSPI';
                             InitialCatalog=""Retail_commerce"";
                                           DataSource=TESTMACH2;
                                       Network Library=dbmssocn"
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.