tags:

views:

683

answers:

1

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?

Thanks guys

PS: I know absolutely nothing about VB6, I'm sure this is a very easy question...

A: 

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.

cheers,
</wqw>

wqw