VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - "克隆"ADO记录集时考虑Key Ponits
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:10334, 日期:2001-02-07
Key points to consider when cloning ADO recordsets

As you can probably guess, the ADO Clone() method creates a copy of the
original recordset. However, be aware that this method does NOT create
two independent recordsets. Rather, it creates two recordset objects
that point to the same records. Changes made to records in one clone
affect all other recordset objects. On the other hand, if you requery
the original recordset, the cloned copies won注释:t be updated, assuming
of course that the requeried recordset contains new data.

Also only bookmarkable recordsets--those with keyset and static cursor
types, for the most part--allow bookmarks, so your code should
determine that a target recordset allows the process before attempting
to clone a recordset. To initiate this test, check the recordset注释:s
Supports property in conjunction with the adBookMark constant, like so

If rstOrig.Supports(adBookMark) Then
     Set rstSub1 = rstOrig.Clone
End If