Home All Groups Group Topic Archive Search About

ADODB Recordsets into Array

Author
22 Mar 2006 2:59 PM
Hugo Hilário
I'd Like to know if is possible to send a collection of adodb.recordsets into
an array. I want this, because i have a function, and i want to hold the
recordset, each time it runs, without losing is values, because, each time it
runs i need the same variable.
Thanks in advance

Author
22 Mar 2006 3:52 PM
Ralph
"Hugo Hilário" <HugoHil***@discussions.microsoft.com> wrote in message
news:5DEC41E3-3B6C-43C1-A5A6-C154D0F8999D@microsoft.com...
> I'd Like to know if is possible to send a collection of adodb.recordsets
into
> an array. I want this, because i have a function, and i want to hold the
> recordset, each time it runs, without losing is values, because, each time
it
> runs i need the same variable.
> Thanks in advance

Take a look at GetRows()

Dim mvRows As Variant
Dim mlRows As Long

mvRows = rs.GetRows
mlRows = UBound(mvRows, 2) + 1

Note: the order of columns will depend on the order returned with your
Select. The order returned by "Select *" can occasionally be surprising.
Better to allways specifically list the Fields.

hth
-ralph
Author
22 Mar 2006 6:11 PM
Hugo Hilário
Thanks, but I think you haven't understant... my fault..
Well I'm trying to populate a flex grid with contents from a table. Just
like windows explorer, in my table, all records have one field, indicating is
parent. This is my Goal.

Look at my function


Private Sub AddDirectory2(ByVal dir As String, ByVal level As Integer)
......
......
......
sqlfilefolders = "SELECT t_signals_1.signal_id, t_signals_1.official_signal,
t_signals_1.signal " & _
                        "FROM (t_signals AS t_signals_1 INNER JOIN t_signals
ON (t_signals_1.official_signal_group_parent = t_signals.official_signal) AND
(t_signals_1.signal_group_id_parent = t_signals.signal_id)) INNER JOIN
t_signals AS t_signals_2 ON (t_signals_1.signal_id =
t_signals_2.signal_group_id_parent) AND (t_signals_1.official_signal =
t_signals_2.official_signal_group_parent) " & _
                        "WHERE (t_signals.signal_id)=" & thisDir & " " & _
                        "GROUP BY t_signals_1.signal_id,
t_signals_1.official_signal, t_signals_1.signal,
t_signals.signal_group_id_parent " & _
                        "HAVING t_signals.signal_group_id_parent=" & dir



rsFileFolders.Open(sqlfilefolders, cnn, ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockReadOnly)


While rsFileFolders.EOF = False

AddDirectory2(rsFileFolders("signal_id").Value, level + 1)

End While


        If rsFileFolders.State = 1 Then
            rsFileFolders.Close()
        End If

End Sub


Well, as you can see, inside the while, the function calls it self, so, my
goal is to preserve that recordset.

Thanks.