asp中REDIM的功能是动态定义数组长度

REDIM [Preserve] 数组名（下标1[下标2....]）
Preserve 保留动态数组的内容（不用的话，每次执行REDIM语句，当前存储的语句会全部丢失）

Dim DynArray() '定义数组DynArray()为动态数组
REDIM Preserve DynArray(20)'为该数组分配元数个数

这样对编程中一些动态的改变数组是非常重要的，而且经常能用到，处理到，这REDIM深入了解第二电脑认为对自己的编程的提高很有帮助。

Dim MyArray
MyArray = Array(1‚5‚123‚12‚98)

Dim MyArray()
for i = 0 to 10
ReDim Preserve MyArray(i)
MyArray(i)=i
next

Dim MyArray
MyArray = Split(tempcnt‚chr(13)&chr(10))
For I = Lbound(MyArray) to Ubound(MyArray)
Response.Write MyArray(I) & "<br>"
Next

function..Sort(ary)
KeepChecking = TRUE
Do Until KeepChecking = FALSE
KeepChecking = FALSE
For I = 0 to UBound(ary)
If I = UBound(ary) Then Exit For
If ary(I) > ary(I+1) Then
FirstValue = ary(I)
SecondValue = ary(I+1)
ary(I) = SecondValue
ary(I+1) = FirstValue
KeepChecking = TRUE
End If
Next
Loop
Sort = ary
End function

Dim MyArray
MyArray = Array(1‚5‚123‚12‚98)
MyArray = Sort(MyArray)
For I = Lbound(MyArray) to Ubound(MyArray)
Response.Write MyArray(I) & "<br>"
Next

Application.Lock
Application("StoredArray") = MyArray
Application.Unlock
LocalArray = Application("StoredArray")

Application.Lock
Application("StoredArray") = LocalArray
Application.Unlock

Session使用方法与Application相同，从数据库中把数据导入数组中：

Dim MyArray
'取出全部记录
MyArray = RS.GetRows
'取出前10项记录
MyArray = RS.GetRows(10)
For row = 0 To UBound(MyArray‚ 2)
For col = 0 To UBound(MyArray‚ 1)
Response.Write (col‚ row) & "<br>"
Next
Next