Faster recordset copying with ADO
Posted on 2002-05-14
I'm using ADO 2.7 to manage a disconnected database in a VB6 app. I want a really fast method of cutting and pasting records.
The ADO Filter property is good for the cut/copy and delete stages but the real bottleneck is in pasting.
The GetRows method provides a fast way of getting records into a 2D variant array which can then be manipulated. But there is no SetRows method to take the "pasted" 2D array so I'm forced, one way or another, to iterate through the edited array to update the recordset field by field - slow !
One tempting alternative is to use streams. No problem saving a recordset to a stream using str.Save, but I can't find a way of writing several blocks of records to the same stream.
Each stream Save adds an ADO header, so that I can only read back from the stream the first recordset I saved.
I'd be quite happy to tackle the problem using direct memory transfers with objPtr/varPtr etc. but can't find any information on how to do this.
Grateful for any help you can give on what must be an increasingly common problem for "disconnected " ADO users.