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



The information in this article applies to:

  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q256259

SUMMARY

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.

MORE INFORMATION

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

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbfix kbhowto KB256259 kbAudDeveloper