Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array size

Status
Not open for further replies.

firehorse24

Programmer
Sep 22, 2006
28
0
0
US
HI,


The array size confused me. I hope someone can help me. I define an array in asp:

Code:
dim ary1()
redim preserve ary1(2)

ary1(0) = "A"
ary1(1) = "B"
ary1(2) = "C"

response.write (ary1(0) & "<br>" & ary1(1) & "<br>" & ary1(2) & "<br>" )
response.write ubound(ary1)

I thought array should contain only 2 elements since the size is 2. why the array can have 3 element?

Thanks!
 
I guess you need to read a little bit more on redmin preserve..

it not only preserves old values but also add any new elements to the array that you specify...

hope this helps..

-DNG
 
Thank you very much DNG,

I have another question. I want to save a local array to session. if local array size increased, does the size of the session array automatically increased too? do I just move the local array to session like:

Code:
 session("ary1") = localarray1

howcome when I retrieve the array from session I got comma in an element?

Thanks a lot !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top