Click to See Complete Forum and Search --> : Collections in ASP: part II


Ryan
03-28-2000, 03:50 AM
So I went through all my books and such and found that it is recommended that
Dictionary objects are used in place of Collection Objects since Collections
aren't valid data types in VBScript. BUT, Dictionary object aren't ordered.
So how in the world do you guys pass higher level variables? Do I have to
create my own object class that looks and acts like a Collection and rewrite
my COM Object for that since as far as I know arrays can't be passed as parameters
in VB? Seems like a waste.

Has anyone out there tried passing more complex data structures from ASP
to a COM Object (written in VB6)? I would be very appreciative of any ideas
that would lead me to overcoming this hurdle.

Thanks
ryan

Gary
03-28-2000, 10:36 AM
"Ryan" <parnell@iname.com> wrote:
>
>So I went through all my books and such and found that it is recommended
that
>Dictionary objects are used in place of Collection Objects since Collections
>aren't valid data types in VBScript. BUT, Dictionary object aren't ordered.
>So how in the world do you guys pass higher level variables? Do I have to
>create my own object class that looks and acts like a Collection and rewrite
>my COM Object for that since as far as I know arrays can't be passed as
parameters
>in VB? Seems like a waste.
>
>Has anyone out there tried passing more complex data structures from ASP
>to a COM Object (written in VB6)? I would be very appreciative of any ideas
>that would lead me to overcoming this hurdle.
>
>Thanks
>ryan

I've had these challenges before. Instead of passing the collection or array
between your ASP and COM objects, simply include in your COM interface a
method to add an item that takes a parameter (ie. String). The ASP should
not have any knowledge of the container class you are using, or if you are
even using a container. It's all in the design. For example:

for class foo, add a method called:

sub public add(byVal value as String)
collectiontype.add value
end sub

where collectiontype is the type you want to use. Have you tried Flexbag
as a collection object? Also, you could use XML as the value coming into
your COM object, parse it in the COM object and store it in the collection.

Hope this helps.
Gary