Définition du tableau
Dimmyarray
MyArray = Array (1,5,123,12,98)
Tableaux prolongés
Dimmyarray ()
fori = 0to10
RedImpreservermyArray (i)
MyArray (i) = I
suivant
Diviser une chaîne et renvoyer un tableau de résultats partagés
Dimmyarray
MyArray = Split (Tempcnt, Chr (13) & Chr (10))
Fori = lbound (myarray) toubound (myarray)
Réponse.writemyArray (i) & "<br>"
Suivant
Fonction de tri du tableau
fonction..sort (ary)
KeepChecking = True
Doultilkeepcheckking = false
KeepChecking = False
Fori = 0Toubound (ary)
Ifi = ubound (ary) alorsxitfor
Ifary (i)> ary (i + 1) alors
FirstValue = ary (i)
SecondValue = ary (i + 1)
ary (i) = secondvalue
ary (i + 1) = firstvalue
KeepChecking = True
Endire
Suivant
Boucle
Trier = ary
Fin de fin.
Exemple d'application de fonction de tri des tableaux
Dimmyarray
MyArray = Array (1,5,123,12,98)
MyArray = Sult (MyArray)
Fori = lbound (myarray) toubound (myarray)
Réponse.writemyArray (i) & "<br>"
Suivant
Utilisation des tableaux dans l'application et la session
Application.lock
Application ("stockorArray") = MyArray
Application.unlock
LocalArray = Application ("StoredArray")
Écraser les tableaux dans l'application
Application.lock
Application ("stockorArray") = localArray
Application.unlock
La session est utilisée de la même manière que l'application
Importez des données de la base de données dans un tableau
Dimmyarray
Sortez tous les enregistrements
MyArray = Rs.Getrows
Sortez les 10 premiers records
MyArray = Rs.Getrows (10)
Forrow = 0Toubound (MyArray, 2)
Forcol = 0Toubound (MyArray, 1)
Response.Write (Col, Row) & "<br>"
Suivant
Suivant