ADO Attributes 属性

定义和用法

Attributes 属性可设置或返回 Long 值,该值可指示对象的一项或多项特性。

注释:设置多个属性时,可以将适当的常量相加。如果将属性值设置为包括不兼容常量的和,将会发生错误。

对象 Attributes 属性的描述
Connection Attributes 属性对 Connection 对象拥有读写权限。并且其值可以是一个或多个 XactAttributeEnum 值的和。默认值为零 (0)。
Parameter Attributes 属性对Parameter 对象拥有读写权限。并且其值可以是任意一个或多个 ParameterAttributesEnum 值的和。默认值为 adParamSigned。
Field 当 Attributes 属性被用于创建 Recordset 时,它拥有读写权限,但是当您打开一个已有的 Recordset 时,它是只读的。Attributes 属性可以是一个或多个 FieldAttributeEnum kuduwa ɗan.
Property gaɗin Property ɗan, Attributes ɗan yana ɗauki ɗauki ɗauki. Kuma ɗauki ɗauki ɗauki ɗan yana ɗauki ɗauki ɗan. PropertyAttributesEnum kuduwa ɗan.

kalumma

object.Attributes

ƙasance

gaɗin Connection ɗan

<%
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
%>

针对 Field 对象:

<%
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
%>

针对 Property 对象:

<%
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 值

Constant Value Description
adXactAbortRetaining 262144 当调用 RollbackTrans,自动启动一个新事务。
adXactCommitRetaining 131072 当调用 CommitTrans,自动启动新事务。

ParameterAttributesEnum Values

Constant Value Description
adParamSigned 16 该参数接受带符号的值。
adParamNullable 64 该参数接受 Null 值。
adParamLong 128 该参数接受长二进制数据。

FieldAttributeEnum Values

Constant Value Description
adFldCacheDeferred 0x1000 指示提供者缓存字段值,并且指示对缓存的进行读取。
adFldFixed 0x10 指示该字段包含定长数据。
adFldIsChapter 0x2000 指示该字段包含一个子集值,指定与此父字段有关的特定子记录集。通常子集字段与数据构形或过滤器一起使用。
adFldIsCollection 0x40000 该字段指定由记录表示的资源是其他资源的集合(如文件夹)而不仅是简单资源(如文本文件)。
adFldIsDefaultStream 0x20000 该字段包含由记录表示的资源的默认流。例如,默认流可以是 Web 站点根文件夹的 HTML 内容,在指定根 URL 时自动提供。
adFldIsNullable 0x20 该字段接受 Null 值。
adFldIsRowURL 0x10000 该字段包含 URL,它命名了记录表示的数据存储中的资源。
adFldKeyColumn 0x8000 该字段是基本行集合的主键。还可指示该字段是复合主键的一部分。
adFldLong 0x80 该字段是长二进制字段。还指示能够使用 AppendChunk 和 GetChunk 方法。
adFldMayBeNull 0x40 A zai iya samun kiyari na Null daga tafinfinan kan tacekewa.
adFldMayDefer 0x2 Tafinfinan kan tacekewa ya yi wuri, kuma kiyari na tacekewa ba a kiyar da su daga abinci na data ba, kuma a kiyar da su daga abinci na data a lokacin da a kiyar da su yi wuri.
adFldNegativeScale 0x4000 Tafinfinan kan tacekewa yana nufin kiyari da daga kiyari da suka ta suka samu kiyari na yawa. Kiyari na yawa yana nufin NumericScale.
adFldRowID 0x100 Tafinfinan kan tacekewa kiyari, kiyari na da yin tsammanin kuma ba da watsi ko yin mahimmanci fiye da wuri, misali, namban wuri, kiyari tsammanin dabbobi, kuma sauransu.
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
  • -1
  • 0xFFFFFFFF
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.