在ASP編程中使用數(shù)組
更新時間:2006年10月09日 00:00:00 作者:
數(shù)組的定義
Dim MyArray
MyArray = Array(1,5,123,12,98)
可擴展數(shù)組
Dim MyArray()
for i = 0 to 10
ReDim Preserve MyArray(i)
MyArray(i)=i
next
將一個字符串分割并返回分割結(jié)果的數(shù)組
Dim MyArray
MyArray = Split(tempcnt,chr(13)&chr(10))
For I = Lbound(MyArray) to Ubound(MyArray)
Response.Write MyArray(I) & "<br>"
Next
數(shù)組排序函數(shù)
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..
數(shù)組排序函數(shù)應用例子
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中使用數(shù)組
Application.Lock
Application("StoredArray") = MyArray
Application.Unlock
LocalArray = Application("StoredArray")
覆蓋Application中的數(shù)組
Application.Lock
Application("StoredArray") = LocalArray
Application.Unlock
Session使用方法與Application相同
從數(shù)據(jù)庫中把數(shù)據(jù)導入數(shù)組中
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
Dim MyArray
MyArray = Array(1,5,123,12,98)
可擴展數(shù)組
Dim MyArray()
for i = 0 to 10
ReDim Preserve MyArray(i)
MyArray(i)=i
next
將一個字符串分割并返回分割結(jié)果的數(shù)組
Dim MyArray
MyArray = Split(tempcnt,chr(13)&chr(10))
For I = Lbound(MyArray) to Ubound(MyArray)
Response.Write MyArray(I) & "<br>"
Next
數(shù)組排序函數(shù)
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..
數(shù)組排序函數(shù)應用例子
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中使用數(shù)組
Application.Lock
Application("StoredArray") = MyArray
Application.Unlock
LocalArray = Application("StoredArray")
覆蓋Application中的數(shù)組
Application.Lock
Application("StoredArray") = LocalArray
Application.Unlock
Session使用方法與Application相同
從數(shù)據(jù)庫中把數(shù)據(jù)導入數(shù)組中
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
相關文章
ASP FSO顯示特殊文件夾的實現(xiàn)代碼(畸形目錄名、UNC路徑)
一些特殊的文件夾asp是沒法完全顯示出來的,但是可以通過unc路徑去刪除,但前提是得知道準確路徑2012-03-03用ASP應用程序?qū)崿F(xiàn)自己的UrlDeCode
URL編碼是指為了將信息通過URL進行傳輸,所以必須將某些含有特殊意義的字符進行替換的一種編碼方式,在asp中我們都知道有一個Server.URLEncode的函數(shù)可以完成這個功能。2006-08-08asp中獲取內(nèi)容中所有圖片與獲取內(nèi)容中第一個圖片的代碼
用asp獲取內(nèi)容中的圖片與獲取內(nèi)容中的第一個圖片地址,主要是cms中保存內(nèi)容中的圖片需要用得到,使用的是正則的方法。2011-01-01asp中利用CSW中文分詞組件來實現(xiàn)自己網(wǎng)站的內(nèi)容關鍵詞自動提取
asp中利用CSW中文分詞組件來實現(xiàn)自己網(wǎng)站的內(nèi)容關鍵詞自動提取...2007-03-03