asp session 使用数组

网络整理 - 09-07

Dim MyArray()
Redim MyArray(5)
Session("StoredArray") = MyArray
用的时候这样:LocalArray = Session("StoredArray")
LocalArray(1) = " there"
Response.Write(LocalArray(0)&LocalArray(1))

又例如:


<%
'建立并初始化数组
dim myarray()
redim myarray(5)
myarray(0)=" "
myarray(1)="这里是asp编程网 "
session("storedarray")=myarray

response.redirect("2.asp")
%>

---2.asp---
<%
'从session中取出数组的值 并更新第二个元素
localarray=session("storedarray")
localarray(1)="there'printingoutthestringhellothere."
response.write(localarray(0)&localarray(1))

'下面的一行代码将session中保留的数组更新
session("storedarray")="localarray "
%>