Storing array object into Application variable

Results 1 to 3 of 3

Thread: Storing array object into Application variable

  1. #1
    Tommy382 Guest

    Default Storing array object into Application variable

    How do I store an array object into the applicaiton-level variable in JScript (I could do it in VBSCript)? Example:<BR><BR>var myArray = new Array(50);<BR>Application("StoredArray") = myArray;<BR><BR>The code above will produce the error "Cannot add object with apartment model behavior to the application intrinsic object."<BR><BR>The same thing is done using VBScript and it works. Example:<BR><BR> dim MyArray()<BR> Redim MyArray(50)<BR> Application("StoredArray") = MyArray<BR><BR>Anyone has any idea why my JScript version of the code doesn&#039t work? Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Storing array object into Application variable

    JScript is coded sloppy, so its arrays are, indeed, <BR>apartment threaded objects. Hence the correct error message.<BR><BR>However, you *can* use JS to access a VBScript array.<BR>Click on the "JScript Reference" link over to the left<BR>on this page and then look in the JS manual for "Objects"<BR>and within the list of objects for "VBArray object".<BR>It&#039s a pretty clumsy thing to use, as you have to first use<BR>VBS to create a safe array. Personally, I&#039d just give up<BR>and use VBS, but if you are really desparate...<BR>

  3. #3
    Tommy382 Guest

    Default Re: JS bug - Thanks so much

    Thank you, I looked everywhere for an answer. You are right, I give up JS ... I ain&#039t gonna go for VB neither. Instead, I go for Java JSP. The servlet part kicks asp&#039s butt completely!<BR><BR>d.t.<BR><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