当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO Clone 方法

ADO
ADO DataTypes
ADO 摘要
ADO 实例

ADO Clone 方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 372 ::
收藏到网摘: n/a

The Clone method allows you to create a duplicate Recordset from an existing Recordset. You can use this method to create multiple, duplicate Recordset, particularly if you want to edit more than one current record in a set of records. This method is much more efficient than creating, opening, and closing a new Recordset equal to the original.
Clone[克隆]的作用是:创建一个现存记录集的复版(即:复制一个当前记录集)。你可以通过使用这个方法来创建多个记录集的复版,特别是当你希望编辑多个记录时。这个方法比起创建、打开或关闭一个记录集更加有效。

When you clone a Recordset you actually just create a new pointer to the same Recordset, therefore any changes you make to one Recordset will be visible in all of its clones. However, if you execute a Requery on the original Recordset, the clones will no longer be synchronized to the original.
当你克隆一个记录集时,你已在相同的记录集上创建了一个新的指针,因此,对于所有被克隆的记录及来说,它的更改信息都是可见的。然而,如果你对原始的记录集执行一个Requery[重新查询]操作,那么所有克隆的记录及信息将不与原记录同步变化。

The provider must support bookmarks on the Recordset object to create clones. Bookmarks are interchangeable; a bookmark reference from one Recordset object refers to the same record in any of its clones. 
 技术提供对象[provider]必须对用于克隆的记录及对象支持bookmarks [书签]参数。Bookmarks [书签]参数是可互换的;记录集对象中的bookmarks [书签]参数可用于指示该记录集的克隆记录集中对应的相同记录。

Note: The filter of the original Recordset will not be applied to the clone. To copy an existing filter: objRecordsetNew.Filter=objRecordsetOriginal.Filter
注意:原记录集中的“过滤器[filter]”也将用于克隆过程。可以使用下面的语句复制现存的“过滤器[filter]”:

Note: When you close the original Recordset none of the copies will be closed. You will have to close the clones one by one.
注意:当你关闭原始记录集时,所有的复版都将被关闭。因此,你不得不逐个地关闭其复版。

Syntax
语法

Set objRecordsetClone=objRecordset.Clone(locktype)

Parameter参数 Description描述
objRecordsetClone The clone Recordset to be created
创建克隆的记录集对象
objRecordset The Recordset to be cloned
指定被克隆的记录集
locktype Optional. A LockTypeEnum value that specifies the lock type
可选参数。指定一个LockTypeEnum值,改制是用来指明锁定类型的


LockTypeEnum Values

Constant常量 Value值 Description描述
adLockUnspecified -1 The clone is created with the same lock type as the original Recordset
创建一个与原来类型相同的锁
adLockReadOnly 1 The clone is a read-only Recordset
默认锁定类型,记录集是只读的,不能修改记录

评论 (0) All

登陆 | 还没注册?