<% '***************************************************************** ' VP-ASP 4.00 ' called by shopthanks to updae Stock Information ' called as a subroutine ' Reads order items and updates product stock levels appropriately ' December 16, 2001 '******************************************************************* dim stockconn, dbc Sub UpdateStock (orderid) oid=orderid OpenOrderdb dbc ' Open the database ShopOpendatabase stockconn strSQL = "select * FROM oitems where orderid = " & Oid Set Items = dbc.Execute(strSQL) UpdateStockDetails ShopCloseDatabase dbc Shopclosedatabase stockconn end sub Sub UpdateStockDetails dim catalogid dim quantity Do While Not Items.EOF quantity=Items("numitems") catalogid=items("catalogid") UpdateStockLevels catalogid, quantity Items.MoveNext Loop closerecordset items end sub ' Sub UpdateStockLevels (catalogid, quantity) dim rsproduct dim myconn dim stock If getconfig("xmysql")="Yes" then mysqlupdatestocklevels catalogid, quantity, stockconn exit sub end if Set rsproduct = Server.CreateObject ("adodb.recordset") sql ="select cstock from products where catalogid=" & catalogid rsproduct.Open SQL, stockconn, adOpenKeyset, adLockOptimistic , adcmdText stock=rsproduct("cstock") stock=stock-quantity rsproduct("cstock")=stock rsproduct.update closerecordset rsproduct end sub %>