' Sort Data with Disconnected Record Set
Const adVarChar = 200' Set the data type to variant.
Const MaxCharacters = 10
arrSample = Array(4, 6, 2, 7, 3, 5, 1)
WScript.Echo vbCrLf & "array before"
For Each intNumber In arrSample
WScript.Echo intNumber
Next
Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "Number", adVarChar, MaxCharacters
DataList.Open
For Each intNumber In arrSample
DataList.AddNew
DataList("Number") = intNumber
DataList.Update
Next
DataList.Sort = "Number"
DataList.MoveFirst
WScript.Echo vbCrLf & "array after"
Do Until DataList.EOF
Wscript.Echo DataList.Fields.Item("Number")
DataList.MoveNext
Loop
DataList.Close