> The objects that you have been talking about in various posts seem fairly
stateful. However they only live as long as single request (unless you
are
storing them in the Session which is seriously not recommended), which
means
that the bulk of server activity is likely to be the creation, loading and
destruction of objects rather than any actual work.
Out of curiousity... What would you use to create a web browser based
application that would have a small (20?) number of clients using it at any
time controlling a database that could eventually contain hundreds of
thousands of records (containing text, numeric and date/time information -
no binaries)
I would suggest that you have a Delete method on the Orders object which
Removes the Order then calls it's Delete method. Why do you think that
this
isn't OO Friendly?
I just thought of something... If I remove the Order object from the
collection, won't it be gone and unavailable for the ORDER Delete method?
This is the code from my Orders collection object
'-- Delete an item in our collection from the DB ------------------------
Public Function Delete(idx)
Dim i 'General counter
'Default is FAIL
Delete=False
'Remove from our collection, and delete from database if we were
successful.
if Me.Remove(idx) then
'Delete Order from database
Me.Item(idx).Delete
'Success
Delete=True
End If
End Function
'-- Remove an item from our collection ----------------------------------
Public Function Remove(idx)
Dim i 'General counter
'Default is FALSE = Fail
Remove = False
'Raise an error if there are no elements at all
If Me.Count=0 Then
Err.Raise 1, "No objects in collection"
Else
'Test for a valid index...
If idx<lBound(vCollection) Or idx>=uBound(vCollection) Then
'..and error if not
Err.Raise 1,"Out of bounds"
Else
'If we aren't removing the last item so we need to move the
' elements down to fill the gap
If idx<uBound(vCollection) Then
For i=idx TO uBound(vCollection)-1
Set vCollection(i) = vCollection(i+1)
Next
End If
'If we are removing the last element, completely clear array
If ElementCount(vCollection) = 1 Then
Dim vCollection()
Else
'Shrink the array holding our collection
ReDim Preserve vCollection(uBound(vCollection)-1)
End If
'Success
Remove = True
End If
End If
End Function