Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<job>
<object id = oRS progid = "ADODB.Recordset"/>
<reference object = "ADODB.Recordset"/>
<script language = "VBScript">
Option Explicit
Sub DefineAndOpenRS()
'Define and open the disconnected recordset
With oRS
.ActiveConnection = Nothing
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
With .Fields
.Append "MyStuff", adVarChar, 255
End With
.Open
End With
End Sub
Sub InsertRow(sData)
'Add data to a new row in the recordset
oRs.AddNew
oRS.Fields.Item("MyStuff").Value = sData
End Sub
Function ConcatRows()
With oRS
.MoveFirst
ConcatRows = ""
Do
ConcatRows = ConcatRows _
& .Fields.Item("MyStuff").Value _
& vbNewLine
.MoveNext
Loop Until .EOF
End With
End Function
Dim lItem, sResults
DefineAndOpenRS
For lItem = 1 To 5
InsertRow(CStr(Rnd)) 'Just some random data.
Next
oRS.Sort = "MyStuff ASC"
sResults = ConcatRows()
oRS.Close
MsgBox sResults, vbOkOnly
</script>
</job>
<job>
<object id = oRS progid = "ADODB.Recordset"/>
<reference object = "ADODB.Recordset"/>
<script language = "VBScript">
'This script demonstrates the use of an ADO disconnected
'Recordset object to sort data on multiple fields.
'
'Here I make heavy use of the Variant "array of arrays"
'concept to keep this example short. For example lngAryA
'is Variant containing an Array of Arrays rather than a
'2-dimensional array.
Option Explicit
Sub DefineAndOpenRS(strAryCols)
'Define and open the disconnected recordset
Dim strCol
With oRS
.ActiveConnection = Nothing
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
With .Fields
For Each strCol In strAryCols
.Append strCol, adInteger
Next
End With
.Open
End With
End Sub
Dim lngAryA, lngRow, strAryColNames, strResults
lngAryA = Array(Array(1, 7, 0), _
Array(5, 9, 1), _
Array(1, 1, 2), _
Array(2, 0, 3), _
Array(2, 3, 1), _
Array(4, 2, 0), _
Array(3, 0, 0), _
Array(1, 0, 1))
'Define a Recordset.
strAryColNames = Array("Col0", "Col1", "Col2")
DefineAndOpenRS(strAryColNames)
'Load our array into the Recordset.
For lngRow = 0 To UBound(lngAryA)
oRS.AddNew strAryColNames, lngAryA(lngRow)
Next
oRS.Sort = "Col0 ASC, Col2 ASC"
'Show results and finish.
oRS.MoveFirst
strResults = oRS.GetString(, , " ", vbCrLf, "-")
oRS.Close
MsgBox strResults, vbOkOnly
</script>
</job>