Definition of array
DimMyArray
MyArray=Array(1,5,123,12,98)
Extended arrays
DimMyArray()
fori=0to10
ReDimPreserveMyArray(i)
MyArray(i)=i
next
Split a string and return an array of split results
DimMyArray
MyArray=Split(tempcnt,chr(13)&chr(10))
ForI=Lbound(MyArray) toUbound(MyArray)
Response.WriteMyArray(I)&"<br>"
Next
Array sorting function
function..Sort(ary)
KeepChecking=TRUE
DoUntilKeepChecking=FALSE
KeepChecking=FALSE
ForI=0toUBound(ary)
IfI=UBound(ary)ThenExitFor
Ifary(I)>ary(I+1)Then
FirstValue=ary(I)
SecondValue=ary(I+1)
ary(I)=SecondValue
ary(I+1)=FirstValue
KeepChecking=TRUE
EndIf
Next
Loop
Sort=ary
Endfunction..
Example of array sorting function application
DimMyArray
MyArray=Array(1,5,123,12,98)
MyArray=Sort(MyArray)
ForI=Lbound(MyArray) toUbound(MyArray)
Response.WriteMyArray(I)&"<br>"
Next
Using arrays in Application and Session
Application.Lock
Application("StoredArray")=MyArray
Application.Unlock
LocalArray=Application("StoredArray")
Overwrite arrays in Application
Application.Lock
Application("StoredArray")=LocalArray
Application.Unlock
The Session is used the same as Application
Import data from the database into an array
DimMyArray
Take out all records
MyArray=RS.GetRows
Take out the first 10 records
MyArray=RS.GetRows(10)
Forrow=0ToUBound(MyArray,2)
Forcol=0ToUBound(MyArray,1)
Response.Write(col,row)&"<br>"
Next
Next