ADO

Getting More Field Information

ADO objects have two types of properties: built-in and dynamic. To this point, only the built-in properties of the Field object have been discussed.

Built-in properties are those properties implemented in ADO and immediately available to any new object, using the MyObject.Property syntax. They do not appear as Property objects in an object's Properties collection.

Dynamic properties are defined by the underlying data provider, and appear in the Properties collection for the appropriate ADO object. For example, a property specific to the provider may indicate if a Recordset object supports transactions or updating. These additional properties will appear as Property objects in that Recordset object's Properties collection. Dynamic properties can be referenced only through the collection, using the syntax MyObject.Properties(0) or MyObject.Properties("Name").

You cannot delete either kind of property.

A dynamic Property object has four built-in properties of its own:

The Properties collection for the Field object contains additional metadata about the field. The contents of this collection vary depending upon the provider. The following code example examines the Properties collection of the sample Recordset introduced at the beginning of this chapter. It first looks at the contents of the collection. This code uses the OLE DB Provider for SQL Server, so the Properties collection contains information relevant to that provider.

'BeginFieldProps
    Dim objProp As ADODB.Property
        
    For intLoop = 0 To (objFields.Count - 1)
        Debug.Print objFields.Item(intLoop).Name
        
        For Each objProp In objFields(intLoop).Properties
            Debug.Print vbTab & objProp.Name & " = " & objProp.Value
        Next objProp
    Next intLoop
'EndFieldProps