ADO Attributes Property
Definition and Usage
The Attributes property can set or return a Long value that can indicate one or more characteristics of an object.
Note:When setting multiple properties, appropriate constants can be added together. If the property value is set to include the sum of incompatible constants, an error will occur.
Object | Description of Attributes property |
---|---|
Connection | The Attributes property has read and write permissions for the Connection object. And its value can be one or more XactAttributeEnum Sum of values. The default value is zero (0). |
Parameter | The Attributes property has read and write permissions for the Parameter object. And its value can be any one or more ParameterAttributesEnum Sum of values. The default value is adParamSigned. |
Field | When the Attributes property is used to create a Recordset, it has read and write permissions, but when you open an existing Recordset, it is read-only. The Attributes property can be one or more FieldAttributeEnum Sum of values. |
Property | For the Property object, the Attributes property is read-only. And its value can be any one or more of PropertyAttributesEnum Sum of values. |
Syntax
object.Attributes
Instance
For the Connection object:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" response.write(conn.Attributes) conn.close %>
For the Field object:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" set rs = Server.CreateObject("ADODB.Recordset") rs.open "Select * from orders", conn set f=Server.CreateObject("ADODB.Field") 'Display the field attributes of the Orders Table for each f in rs.Fields response.write("Attr:" & f.Attributes & "<br />") response.write("Name:" & f.Name & "<br />") response.write("Value:" & f.Value & "<br />") Next rs.Close conn.close set rs=nothing set conn=nothing %>
For the Property object:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" set rs = Server.CreateObject("ADODB.Recordset") rs.open "Select * from orders", conn set prop=Server.CreateObject("ADODB.Property") 'Display the property attributes of the Orders Table for each prop in rs.Properties response.write("Attr:" & prop.Attributes & "<br />") response.write("Name:" & prop.Name & "<br />") response.write("Value:" & prop.Value & "<br />") next rs.close conn.close set rs=nothing set conn=nothing %>
XactAttributeEnum value
Constant | Value | Description |
---|---|---|
adXactAbortRetaining | 262144 | When calling RollbackTrans, an automatic new transaction is initiated. |
adXactCommitRetaining | 131072 | Automatically starts a new transaction when CommitTrans is called. |
ParameterAttributesEnum Values
Constant | Value | Description |
---|---|---|
adParamSigned | 16 | This parameter accepts signed values. |
adParamNullable | 64 | This parameter accepts Null values. |
adParamLong | 128 | This parameter accepts long binary data. |
FieldAttributeEnum Values
Constant | Value | Description |
---|---|---|
adFldCacheDeferred | 0x1000 | Indicates that the provider caches the field values and indicates that caching is to be read. |
adFldFixed | 0x10 | Indicates that this field contains fixed-length data. |
adFldIsChapter | 0x2000 | Indicates that this field contains a subset value that specifies a particular sub-record set related to this parent field. Subset fields are often used with data shaping or filters. |
adFldIsCollection | 0x40000 | This field specifies that the resource represented by the record is a collection of other resources (such as folders) rather than a simple resource (such as a text file). |
adFldIsDefaultStream | 0x20000 | This field contains the default stream of the resource represented by the record. For example, the default stream can be the HTML content of the root folder of a web site, which is automatically provided when the root URL is specified. |
adFldIsNullable | 0x20 | This field accepts Null values. |
adFldIsRowURL | 0x10000 | This field contains a URL that names the resource in the data storage represented by the record. |
adFldKeyColumn | 0x8000 | This field is the primary key of the basic row collection. It can also indicate that this field is part of a composite primary key. |
adFldLong | 0x80 | This field is a long binary field. It also indicates that AppendChunk and GetChunk methods can be used. |
adFldMayBeNull | 0x40 | Null values can be read from this field. |
adFldMayDefer | 0x2 | This field is deferred, meaning that the field value is not retrieved from the data source along with the entire record, but is retrieved when explicitly accessed. |
adFldNegativeScale | 0x4000 | This field represents the numeric value from a column that supports negative range values. The range is specified by the NumericScale attribute. |
adFldRowID | 0x100 | This field contains a persistent identifier that cannot be written and has no meaning except for identifying the row, such as record number, unique identifier, etc. |
adFldRowVersion | 0x200 | This field contains some time or date stamp for tracking updates. |
adFldUnknownUpdatable | 0x8 | The provider cannot determine whether the user can write to the field. |
adFldUnspecified |
|
The provider has not specified the field attributes. |
adFldUpdatable | 0x4 | Users can write to the field. |
PropertyAttributesEnum Values
Constant | Value | Description |
---|---|---|
adPropNotSupported | 0 | The provider does not support this property. |
adPropRequired | 1 | Users must specify the value of this property before initializing the data source. |
adPropOptional | 2 | Users do not need to specify the value of this property before initializing the data source. |
adPropRead | 512 | Users can read this property. |
adPropWrite | 1024 | Users can set this property. |