Microsoft KB Archive/256259: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 44: Line 44:
== SUMMARY ==
== 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.
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.


</div>
</div>
Line 59: Line 59:
Private Sub Main()
Private Sub Main()


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


mysimplelist.Add (&quot;value1&quot;)
mysimplelist.Add ("value1")
mysimplelist.Add (&quot;value2&quot;)
mysimplelist.Add ("value2")
mysimplelist.Add (&quot;value3&quot;)
mysimplelist.Add ("value3")


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


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


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


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



Latest revision as of 13:53, 21 July 2020

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



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

Keywords: kbhowto kbfix KB256259