Reputation: 2485
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?
Upvotes: 0
Views: 4296
Reputation: 11991
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.
Upvotes: 1