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
總結
以上是生活随笔為你收集整理的VB中Recordset的clone方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 抖音直播带货数据在哪里看?有哪些考核指标
- 下一篇: everything使用经验总结——待续