VB中Recordset的clone方法
Use the Clone method to create multiple, duplicate Recordset objects, particularly if you want to be able to maintain more than one current record in a given set of records. Using the Clone method is more efficient than creating and opening a new Recordset object with the same definition as the original.
The current record of a newly created clone is set to the first record.
我也不知道是怎么回事情?郁闷。查閲了一下msdn:
Changes you make to one Recordset object are visible in all of its clones regardless of cursor type. However, once you execute Requery on the original Recordset, the clones will no longer be synchronized to the original.
Closing the original Recordset does not close its copies; nor does closing a copy close the original or any of the other copies.
You can only clone a Recordset object that supports bookmarks. Bookmark values are interchangeable; that is, a bookmark reference from one Recordset object refers to the same record in any of its clones.
再次查閲了clone原理之後,引用了博客園天伤之梦的一段話描述clone:获取浅表副本就是把这本书直接接给读者,获取深层副本就是把这本书留着(或者销毁),抄写一份给读者()。
C#中dataset的copy方法是深copy,clone方法只是淺clone而已代码:
Dim objPrv As Object 'SYSRRVB.clsPPrv
Dim objRectemp As New ADODB.Recordset
Dim objRectempcopy, Rectempcopy1 As New ADODB.Recordset
Dim strtemp
Set objPrv = CreateObject("'SYSRRVB.clsPPrv")
If Me.chkDep.Value = 1 Then
Set objRectemp = m_Buffer.Records(CLng(Mid(Trim$(Me.trvOrg.SelectedItem.Key), 2, 1)))
Set objRectempcopy= objRectemp .Clone
Set Rectempcopy1 = objRectemp
******
end if
clone的方法原理倒查閲了不少,但一直不知道爲什麽clone對象double原來的一倍?,而且增加的和原來的對象還不完全相同。?
转载于:https://www.cnblogs.com/PeterWang/archive/2004/11/04/60596.html
- 点赞
- 收藏
- 分享
- 文章举报
- AutoCAD VBA xdata的使用+水泵性能曲线VBA绘制程序
- sw+vba非批量操作=180822
- vb.net如何打开指定文件
- SD--关于销售订单的VBAP-WERKS决定代码摘抄分析
- vb+Flex的关于FlashPlayer的检测
- VBS中正则表达式的使用格式
- VBS中dictionary的用法
- VBS 计算除周六周日的天数
- 承载 ComboBox 控件的 DataGridColumnStyle (VB.NET)
- kjvba
- VBA宏密码破解
- 求救:用vb.net编写window下应用程序中如何将带中文字符串进行url编码?
- VB.net(VB6)String类型、中文、日文与Unicode互相转换
- vb.net 设置ListView单列显示
- 无题VB
- VBE各窗口的功能介绍
- VBA程序设计
- VBA之FormulaR1C1属性
- VBA之Range,cells,offset,end 的区别
- VBA基本操作