Microsoft KB Archive/256259

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:53, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base

How to Add a SimpleList to an OrderForm and Persist It to the Database with DBStorage

Article ID: 256259

Article Last Modified on 6/24/2004


  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q256259


This "More Information" section of this article contains a code example that allows you to add a SimpleList object to an OrderForm object and store it in the database using the DBStorage object.


Use the following Visual Basic 6.0 code example to add a SimpleList object to an OrderForm object and persist the OrderForm object to the database with the DBStorage object:

Dim mysimplelist As Object
Dim mscsorderformstorage As Object
Dim MSCSShopperManager As Object
Dim mscsorderform As Object

Private Sub Main()

Set mysimplelist = CreateObject("Commerce.Simplelist")
Set mscsorderformstorage = CreateObject("Commerce.DBStorage")
Set MSCSShopperManager = CreateObject("Commerce.StandardSManager")
Call MSCSShopperManager.InitManager("", "")
Call mscsorderformstorage.initstorage("DSN=SSCommerce3;UID=SA;PWD=", "vc30_receipt", "order_id", "Commerce.Orderform", "marshalled_receipt", "date_changed")

mysimplelist.Add ("value1")
mysimplelist.Add ("value2")
mysimplelist.Add ("value3")

'You will have to paste in your own order_id argument here

Set mscsorderform = mscsorderformstorage.GetData(Null, "SGPR51TLRWS12PNS00Q799HC77")

'Then once you have retrieved the orderform you can modify it as follows:

mscsorderform.prefix = "*" 'change prefix from default of underscore so dbstorage will persist any items beginning with underscore to database
Set mscsorderform.list2 = mysimplelist

'After modifying the orderform, you would then need to commit the modified orderform back to the marshalled column using the dbstorage commitdata method:

Call mscsorderformstorage.CommitData(Null, mscsorderform)
End Sub

Keywords: kbhowto kbfix KB256259