记录对象 (ADO)Record Object (ADO)

表示 记录集 或数据提供程序中的行,或由半结构化数据访问接口(如文件或目录)返回的对象。Represents a row from a Recordset or the data provider, or an object returned by a semi-structured data provider, such as a file or directory.

备注Remarks

Record 对象表示一行数据,并与一行 记录集 有一些概念上的相似之处。A Record object represents one row of data, and has some conceptual similarities with a one-row Recordset. 根据提供程序的功能,可以直接从提供程序(而不是单行 记录集)返回 记录 对象,例如,当执行仅选择一行的 SQL 查询时。Depending on the capabilities of your provider, Record objects may be returned directly from your provider instead of a one-row Recordset, for example when an SQL query that selects only one row is executed. 或者,可以直接从 记录集 对象获取 记录 对象。Or, a Record object can be obtained directly from a Recordset object. 或者, 记录 可以直接从提供程序返回到半结构化数据,例如 Microsoft Exchange OLE DB 提供程序。Or, a Record can be returned directly from a provider to semi-structured data, such as the Microsoft Exchange OLE DB provider.

您可以通过 record 对象上的 字段集合来查看与 record 对象相关联的字段。You can view the fields associated with the Record object by way of the Fields collection on the Record object. ADO 允许对象值列,包括 记录 对象的 Fields 集合中的 记录集SafeArray 和标量值。ADO allows object-valued columns including Recordset, SafeArray, and scalar values in the Fields collection of Record objects.

如果 Record 对象表示 记录集中 的某行,则可以使用 Source属性返回到该原始 记录集If the Record object represents a row in a Recordset, it is possible to return to that original Recordset with the Source property.

记录 对象还可以由半结构化数据提供程序使用,例如用于 Internet 发布的 Microsoft OLE DB 提供程序,以及为树状结构命名空间建模。The Record object can also be used by semi-structured data providers such as the Microsoft OLE DB Provider for Internet Publishing, to model tree-structured namespaces. 树中的每个节点都是具有关联列的 记录 对象。Each node in the tree is a Record object with associated columns. 列可以表示该节点的属性和其他相关信息。The columns can represent the attributes of that node and other relevant information. Record 对象可以表示叶节点和树结构中的非叶节点。The Record object can represent both a leaf node and a non-leaf node in the tree structure. 非叶节点具有其他节点作为其内容,但叶节点没有此类内容。Non-leaf nodes have other nodes as their contents, but leaf nodes do not have such contents. 叶节点通常包含数据的二进制流,而非叶节点还可能具有与其关联的默认二进制流。Leaf nodes typically contain binary streams of data and non-leaf nodes may also have a default binary stream associated with them. 记录 对象的属性标识节点的类型。Properties on the Record object identify the type of node.

Record 对象还表示用于导航分层组织的数据的另一种方法。The Record object also represents an alternative way for navigating hierarchically organized data. 可以创建 记录 对象来表示大型树结构中特定子树的根,并可以打开新的 记录 对象来表示子节点。A Record object may be created to represent the root of a specific sub-tree in a large tree structure and new Record objects may be opened to represent child nodes.

资源 (例如,文件或目录) 可以通过绝对 URL 来唯一标识。A resource (for example, a file or directory) can be uniquely identified by an absolute URL. 当使用绝对 URL 打开 记录 时,将隐式创建 连接对象并将其设置为 record 对象。A Connection object is implicitly created and set to the Record object when the Record is opened by using an absolute URL. 可以通过 ActiveConnection属性将 连接 对象显式设置为 Record 对象。A Connection object may explicitly be set to the Record object via the ActiveConnection property. 使用 连接 对象可以访问的文件和目录定义了 记录 操作可能发生的 上下文The files and directories that can be accessed by using the Connection object define the context in which Record operations may occur.

记录 对象上的数据修改和导航方法还接受一个相对 url,该 url 将使用绝对 Url 或 连接 对象上下文作为起始点查找资源。Data modification and navigation methods on the Record object also accept a relative URL, which locates a resource using an absolute URL or the Connection object context as a starting point.

备注

使用 http 方案的 Url 将自动调用 用于 Internet 发布的 Microsoft OLE DB 提供程序URLs using the http scheme will automatically invoke the Microsoft OLE DB Provider for Internet Publishing. 有关详细信息,请参阅 绝对和相对 urlFor more information, see Absolute and Relative URLs.

连接 对象与每个 Record 对象相关联。A Connection object is associated with each Record object. 因此, 记录 对象操作可以通过调用 连接 对象事务方法来成为事务的一部分。Therefore, Record object operations can be part of a transaction by invoking Connection object transaction methods.

Record 对象不支持 ADO 事件,因此将不会响应通知。The Record object does not support ADO events, and therefore will not respond to notifications.

对于 Record 对象的方法和属性,您可以执行以下操作:With the methods and properties of a Record object, you can do the following:

  • 设置或返回具有 ActiveConnection属性的关联 连接 对象。Set or return the associated Connection object with the ActiveConnection property.

  • 使用 Mode 属性指示访问权限。Indicate access permissions with the Mode property.

  • 返回目录的 URL (如果有),其中包含具有 ParentURL属性的 记录 所表示的资源。Return the URL of the directory, if any, that contains the resource represented by the Record with the ParentURL property.

  • 指示用 Source属性派生 记录 的绝对 url、相对 url 或 记录集Indicate the absolute URL, relative URL, or Recordset from which the Record is derived with the Source property.

  • State属性指示 记录 的当前状态。Indicate the current status of the Record with the State property.

  • 通过 RecordType 属性指示 记录 的 - 简单集合结构化文档 的类型 Indicate the type of Record - simple, collection, or structured document - with the RecordTypeproperty.

  • 使用 Cancel 方法停止执行异步操作。Stop execution of an asynchronous operation with the Cancel method.

  • 使用 Close方法将 记录 与数据源解除关联。Disassociate the Record from a data source with the Close method.

  • 使用 CopyRecord方法将 记录 表示的文件或目录复制到另一个位置。Copy the file or directory represented by a Record to another location with the CopyRecord method.

  • 删除使用 DeleteRecord方法由 a 记录 表示的文件或目录和子目录。Delete the file, or directory and subdirectories, represented by a Record with the DeleteRecord method.

  • 使用 GetChildren方法打开一个 记录集,其中包含的行表示由 记录 表示的实体的子目录和文件。Open a Recordset that contains rows that represent the subdirectories and files of the entity represented by the Record with the GetChildren method.

  • 使用 MoveRecord方法将 (重命名) 文件或目录和子目录中的一个 记录 表示为另一个位置。Move (rename) the file, or directory and subdirectories, represented by a Record to another location with the MoveRecord method.

  • 记录 与现有数据源关联,或使用 Open 方法创建新的文件或目录。Associate the Record with an existing data source, or create a new file or directory with the Open method.

记录 对象对于脚本是安全的。The Record object is safe for scripting.

本部分包含以下主题。This section contains the following topic.

另请参阅See Also

字段集合 (ADO) Fields Collection (ADO)
ADO) (属性集合 Properties Collection (ADO)
记录和流 Records and Streams
记录集对象 (ADO)Recordset Object (ADO)