create your own data container?

Results 1 to 2 of 2

Thread: create your own data container?

  1. #1
    kevin Guest

    Default create your own data container?

    I have seen a lot of people wondering how to pass information from ASP to COM and viceversa. I have come up with what seems to me a very simple solution:<BR><BR>Create a COM that wraps a language specific data container, in this case a java Vector. then pass this from the com to the ASP page like this:<BR><BR>Java COM Container<BR>public class StringArray<BR>{<BR>private java.util.Vector myVector;<BR>public void addString(String addString){<BR>this.myVector.addElement(addString) ;<BR>}<BR>public String getString(int arrayIndex){<BR>return (String) this.myVector.elementAt(arrayIndex);<BR>}<BR>}<BR> <BR>Now I can create this component inside ASP, fill it using setString, pass it to my COM that uses the getString to get the data. <BR><BR>I have something like this working from ASP to a vb and a java COM and vice versa. <BR><BR>My concern is that this seems like such an obvious solution to this problem that I would expect everybody to be using it if there weren&#039t some serious drawbacks. <BR>Anybody care to comment on this? <BR><BR>Kev

  2. #2
    Join Date
    Dec 1969

    Default RE: create your own data container?

    A fine solution.<BR><BR>Just a bit inefficient. Suppose I have an array of 100 integers I need to transfer. Using this system, I&#039d have to convert each integer to a string, add it to the array, pass the array, and then convert each string back to an integer in the receiver.<BR><BR>Yes, yes, I could create a Java Vector of Integer objects instead, for that case. Not a whole lot more efficient, as you would still have an array of 100 objects in place of the array of 100 primitive values. But some help.<BR><BR>In short: I&#039d use this as a "backup" or "emergency" technique when I couldn&#039t find another way to get the "pieces" to talk to each other. But for more efficiency you&#039re better off tailoring your COM (well, ActiveX) component to receive data from VBS (or JS) in the "native" VBS format. Which is, of course, simply as Variant arguments, including even a Variant that references a SafeArray of Variant instances. But, again, when you have to interface to an existing COM object and you can&#039t change the object&#039s source...sure, why not? <BR><BR>Oh...and if you aren&#039t using this in a high volume spot, then the answer is surely "why not?"<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts