日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

VB中Recordset的clone方法

發(fā)布時(shí)間:2024/3/12 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VB中Recordset的clone方法 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在用vb的時(shí)候,發(fā)現(xiàn)了個(gè)奇怪的問(wèn)題,見(jiàn)下面代碼,在生成Recordset的過(guò)程中,調(diào)用了recordset的clone方法,clone后沒(méi)有做任何操作,及時(shí)跟蹤的過(guò)程中發(fā)現(xiàn)clone前的原recordset對(duì)象rectemp的recordcount是26,但是但調(diào)用Recordset的clone方法后,居然發(fā)現(xiàn)clone后新的複製本rectempcopy 比rectemp多了一倍的記錄。郁悶,難道clone了還多出一倍?查詢msdn,上面這么描述,

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原理之後,引用了博客園天傷之夢(mèng)的一段話描述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的方法原理倒查閲了不少,但一直不知道爲(wèi)什麼clone對(duì)象double原來(lái)的一倍?,而且增加的和原來(lái)的對(duì)象還不完全相同。?

轉(zhuǎn)載于:https://www.cnblogs.com/PeterWang/archive/2004/11/04/60596.html

總結(jié)

以上是生活随笔為你收集整理的VB中Recordset的clone方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。