Thanks for the idea. If I understand it correctly, in the constructor
for MyClass, I would need to read the values of the fields in the
recordset and then create a new record from that, which would provide
me with an array of DatabaseRecords in the end. I was hoping to find
that there was something built into the RS implementation of the
Database class that would allow me to access a subset of the
recordset.
In the end I came up with another solution. I get a recordset that
contains just the primary keys of all the records in the table and
then iterates over that set to access one record at a time and feed it
to the constructor for my internal object.
On 9/23/06, Norman Palardy <[EMAIL PROTECTED]> wrote:
On Sep 23, 2006, at 5:22 PM, Dennis Birch wrote:
> Is this possible?
>
> I'd like to iterate over a recordset that could contain several
> records, and feed them one record at a time to another method that
> repackages them for me in an object my application can pass around
> more easily. What's the syntax for doing that if it's possible?
Sure
something like
function Create(rs as RecordSet) as MyClass()
dim myRecordsAsCaslsses(-1) as MyClass
while rs.EOF <> true
myRecordsAsCaslsses.append (new MyClass(rs)) // creates a new
instance of MyClass from the current record in the record set
rs.moveNext
wend
return myRecordsAsCaslsses
creation of the MyClass object is left as an exercise for the reader :)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>