CreateRecordset Method Example (VBScript)

Microsoft ActiveX Data Objects (ADO)

CreateRecordset Method Example (VBScript)

This code example creates a Recordset on the server side. It has two columns with four rows each.

Sub CreateARecordSet
    Dim ColInfo(1), c0(3), c1(3)

    c0(0) = "Name"            ' Column name. 
    c0(1) = CInt(129)        ' Column type (129 = adChar).
    c0(2) = CInt(40)        ' Column size.
    c0(3) = False            ' Is the column nullable?

    c1(0) = "Age"            ' Column name. 
    c1(1) = CInt(3)        ' Column type (3 = adInteger).
    c1(2) = CInt(-1)        ' Column size.
    c1(3) = True            ' Is the column nullable?

    ' Add the columns to the recordset definition.
    ColInfo(0) = c0
    ColInfo(1) = c1

    ADC1.SourceRecordset = ADF1.CreateRecordset(ColInfo)
End Sub