an ASP array ???

Results 1 to 6 of 6

Thread: an ASP array ???

  1. #1
    Eric Kowalewski Guest

    Default an ASP array ???

    When I do this:<BR><BR>&#060;%<BR>Dim temp(4)<BR>temp(0)="E"<BR>temp(1)="R"<BR>temp(2)=" I"<BR>temp(3)="C"<BR><BR>response.write temp<BR> <BR>%&#062;<BR><BR><BR>I get this:<BR><BR>Response object error &#039;ASP 0106 : 80020005&#039; <BR><BR>Type Mismatch <BR><BR>? <BR><BR>An unhandled data type was encountered. <BR><BR><BR>Why?

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default You cannot write an array

    you have to loop through it and write out its elements one at a time and not the whole thing at once

  3. #3
    Join Date
    Dec 1969

    Default RE: an ASP array ???

    You need to response.write the elements of your array individually (as in a loop)...<BR><BR>for i = 0 to 3<BR>response.write temp (i)<BR>next

  4. #4
    Eric Kowalewski Guest

    Default RE: You cannot write an array

    How then do you write a function that returns an array?

  5. #5
    Join Date
    Dec 1969

    Default Return an array..

    Like this....<BR><BR>&#060;SCRIPT language="javascript" RUNAT="SERVER"&#062; <BR>//DEFINE THE CODE <BR>function a() <BR>{ <BR>//Define the array <BR>var arr_One = new Array(2); <BR>arr_One[0]= new Array(2); <BR>arr_One[1]= new Array(2); <BR><BR>//Populate the array <BR>arr_One[0] [0]=&#039;THIS &#039;; <BR>arr_One[0] [1]=&#039;IS &#039;; <BR>arr_One[1] [0]=&#039;A &#039;; <BR>arr_One[1] [1]=&#039;TEST &#039;; <BR><BR> return arr_One; <BR>} <BR><BR><BR><BR>

  6. #6
    Join Date
    Dec 1969

    Default Return array no different...

    ...than returning any other thing.<BR><BR>In VBS:<BR><BR>&#060;%<BR>Function getArray( size )<BR>&nbsp; &nbsp; Dim i, ar( )<BR>&nbsp; &nbsp; ReDim ar( size )<BR>&nbsp; &nbsp; For i = 0 To size<BR>&nbsp; &nbsp; &nbsp; &nbsp; ar(i) = i<BR>&nbsp; &nbsp; Next<BR>&nbsp; &nbsp; getArray = ar<BR>End Function<BR>%&#062;<BR><BR>Why did you think it would be any different?<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