仅从记录集中复制 1 行 (VB6)

发布于 2024-07-27 17:51:12 字数 144 浏览 6 评论 0原文

我在 VB6 中有一个包含多行的记录集。 我必须将当前(在循环中)行复制到另一个 RecordSet(仅包含该行)。

源 RecordSet 是从 SQL 查询中检索的。 目的地,只是一个供本地使用的容器。

我怎么能这么做呢?

I have a RecordSet in VB6 containing multiple rows. I have to copy the current (in a loop) row, and only this one, to another RecordSet (which will contain only that row).

The source RecordSet is retrieved from a SQL query. The destination, is only a container for local use.

How could I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别把无礼当个性 2024-08-03 17:51:12

几个有用的函数:

Public Function FilterRecordset(rsSrc As Recordset, sFilter As String) As Recordset
    Dim rsClone As Recordset

    Set rsClone = rsSrc.Clone
    rsClone.Filter = sFilter
    Set FilterRecordset = New Recordset
    Set FilterRecordset.DataSource = rsClone
End Function

Public Function CloneRecordset(rsSrc As Recordset) As Recordset
    With New PropertyBag
        .WriteProperty "rs", rsSrc, Nothing
        Set CloneRecordset = .ReadProperty("rs", Nothing)
    End With
End Function

这​​些函数在客户端 ADO 记录集上效果最好。

Couple of useful functions:

Public Function FilterRecordset(rsSrc As Recordset, sFilter As String) As Recordset
    Dim rsClone As Recordset

    Set rsClone = rsSrc.Clone
    rsClone.Filter = sFilter
    Set FilterRecordset = New Recordset
    Set FilterRecordset.DataSource = rsClone
End Function

Public Function CloneRecordset(rsSrc As Recordset) As Recordset
    With New PropertyBag
        .WriteProperty "rs", rsSrc, Nothing
        Set CloneRecordset = .ReadProperty("rs", Nothing)
    End With
End Function

These work best on client-side ADO recordsets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文