You can use the ADOR.Recordset object to marshal recordsets from a client Web page to a middle-tier business object. For example, suppose a user connects to a virtual shopping mall and selects a number of items to purchase. The selected items appear in the virtual shopping cart that is implemented with the RDS.DataControl object and buffered in a rowset. When the client clicks the purchase button, an ADOR.Recordset object is created and passed to an application server as an input parameter to a business function (ApplyUpdates
). This causes the Recordset to be marshaled across to the server. The ApplyUpdates
business function then connects to the Sales database and applies the updates.
' Code on a client Web page.
Sub PurchaseItem_OnClick
Set rst = ADC1.Recordset
' The following option tells the recordset to only send
' back changed records when updating. This makes the roundtrips
' more lightweight.
rst.MarshalOptions = adMarshalModifiedOnly
' Call the ApplyUpdates function on the MyObj
' business object and pass the ador.Recordset
' object as an input parameter.
MyObj.ApplyUpdates rst
End Sub
' VB code in the business object.
' ApplyUpdates is a method in a
' middle-tier business object.
Sub ApplyUpdates(rst As ADOR.Recordset)
rst.ActiveConnection = _
"DSN=SalesDB;UID=SMgr;PWD=password"
' Save the changed records.
rst.UpdateBatch
End Sub