在用vb的时候,发现了个奇怪的问题,见下面代码,在生成Recordset的过程中,调用了recordset的clone方法,clone后沒有做任何操作,及時跟踪的过程中发现clone前的原recordset對象rectemp的recordcount是26,但是但调用Recordset的clone方法后,居然发现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.

相关文章: