[原创]asp数组使用[2007-10-16]
[code]在ASP编程中使用数组数组的定义
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和Session中使用数组
Application.Lock
Application("StoredArray") = MyArray
Application.Unlock
LocalArray = Application("StoredArray")
覆盖Application中的数组
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[/code] 我回不回呢 考虑再三 还是不回了吧 ^_^ 一楼的位置好啊..我考,这是一种文明,我指 的是回帖。
管住自己的嘴巴
不要谈论自己,更不要议论别人。[url=http://qosoo.cn/]机战私服[/url]谈论自己往往会自大虚伪,在名不副实中失去自己。[url=http://www.zhizuntl.cn/]天龙私服[/url]议论别人往往陷入鸡毛蒜皮的是非口舌中纠缠不清。每天下班后和你的那些同事朋友喝酒聊天可不是件好事[url=http://www.sf1111.com/]传世私服[/url],因为,这中间往往会把议论同事、朋友当做话题。背后议论人总是不好的,尤其是议论别人的短处,这些会降低你的人格页:
[1]