ADO » DataFactory » CreateRecordset

Set recordsetobject = datafactoryobject.CreateRecordset(ColumnInfos)
The ColumnInfos parameter is a variant array (collection of arrays) where each array in the collection contains four required attributes that define each column in the Recordset object. The four attributes are: Name, Type, Size, and Nullability.

Creates and returns an empty (unpopulated) and disconnected Recordset object.

The CreateRecordset method is called to create and return a new, empty Recordset object.

There is one mandatory parameter.

The Name attribute is the name of the column.

The Type attribute is one of the DataTypeEnum constants. RDS may substitute types for those data types marked with an * in the table. After the Recordset is created, you can check to determine the actual type.
Fixed-length DataTypeEnum Constants

Constant Value Length Description
adArray 0x2000 Fixed Combine with another data type to indicate that the other data type is an array
adBigInt 20 Fixed 8-byte signed integer
adBinary 128 Variable Binary
adBoolean 11 Fixed True or false Boolean
*adBSTR 8 Variable Null-terminated character string
adChapter - - Not recognized
*adChar 129 Variable String
adCurrency 6 Fixed Currency format
adDate 7 Fixed Number of days since 12/30/1899
adDBDate 133 Fixed YYYYMMDD date format
adDBFileTime - - Not recognized
adDBTime 134 Fixed HHMMSS time format
*adDBTimeStamp 135 Fixed YYYYMMDDHHMMSS date/time format
adDecimal 14 Fixed Number with fixed precision and scale
adDouble 5 Fixed Double-precision floating-point
adEmpty - - Not recognized
adError 10 Fixed 32-bit error code
adFileTime - - Not recognized
adGUID 72 Fixed Globally Unique identifier
adIDispatch - - Not recognized
adInteger 3 Fixed 4-byte signed integer
adIUnknown - - Not recognized
*adLongVarBinary 205 Variable Long binary value
*adLongVarChar 201 Variable Long string value
*adLongVarWChar - - Not recognized
adNumeric 131 Fixed Number with fixed precision and scale
adPropVariant - - Not recognized
adSingle 4 Fixed Single-precision floating-point value
adSmallInt 2 Fixed 2-byte signed integer
adTinyInt 16 Fixed 1-byte signed integer
adUnsignedBigInt 21 Fixed 8-byte unsigned integer
adUnsignedInt 19 Fixed 4-byte unsigned integer
adUnsignedSmallInt 18 Fixed 2-byte unsigned integer
adUnsignedTinyInt 17 Fixed 1-byte unsigned integer
adUserDefined - - Not recognized
adVarBinary 204 Variable Binary value
adVarChar 200 Variable String
adVariant - - Not recognized
adVarNumeric 139 Fixed Variable width exact numeric with signed scale
*adVarWChar 202 Variable Null-terminated Unicode character string
adWChar 130 Variable Null-terminated Unicode character string

The Size attribute is an integer that is the length of the data type. Fixed-length data types must be defined with a -1. Variable-length data types can range from 1 to 32767.

The Nullability attribute is a Boolean value. If True, null values are allowed in the column. If False, null vales are not allowed.


' Name
avarDataArray1(0) = "Age"
' Type
avarDataArray1(1) = adInteger
' Size
avarDataArray1(2) = -1
' Nullability
avarDataArray1(3) = False
avarColumnInfosArray = Array(avarDataArray1, avarDataArray2, avarDataArray3)
Set objRecordset = objDataFactory.CreateRecordset(avarColumnInfosArray)

See Also: