Page 1 of 1
ADO: load recordset into an Array
Posted: Sat Nov 16, 2019 2:24 pm
by MOISES
Hi,
In my previous Harbour and FWH version, in order to load contents of Recordset in ADO, I did:
Code: Select all
IF ! ( oRsClientes:Eof .and. oRsClientes:Bof )
oRsClientes:MoveFirst()
aArray1 := oRsClientes:GetRows()
ENDIF
But now, the format of the array is wrong. Is there another way to achieve the result?
Thank you.
Re: ADO: load recordset into an Array
Posted: Sat Nov 16, 2019 6:00 pm
by leandro
Re: ADO: load recordset into an Array
Posted: Sat Nov 16, 2019 9:03 pm
by MOISES
Now I have problems with XBROWSE COMMAND:
@ 0, 0 XBROWSE oPanel2:oControl OF oDash ;
COLUMNS 1, 2, 3, 4, 5, 6 ;
HEADERS "Nº Cliente", oSayDNI(), "Apellidos", "Nombre", "Localidad", "Teléfono" ;
ARRAY aArray1 ;
PICTURES "9,999,999"
Does not show the hash.
But the recordset is converted into hash with RsToHash()
Thank you,
Re: ADO: load recordset into an Array
Posted: Sun Nov 17, 2019 4:31 am
by nageswaragunupudi
MOISES wrote:Hi,
In my previous Harbour and FWH version, in order to load contents of Recordset in ADO, I did:
Code: Select all
IF ! ( oRsClientes:Eof .and. oRsClientes:Bof )
oRsClientes:MoveFirst()
aArray1 := oRsClientes:GetRows()
ENDIF
But now, the format of the array is wrong. Is there another way to achieve the result?
Thank you.
This is due to a change in the Harbour libraries. Nothing to do with FWH.
We have now provided a function
Code: Select all
aRows := RsGetRows( oRs, [nRows], [nStart], [aFields] )
This function is safe to use with Harbour (both new and old versions) and also xHarbour.
You need to change all
as
EVERYWHERE in your application. There is no escape from this, because of the change in Harbour libraries.
Depending on your requirements, you can also use
Code: Select all
hData := RsToHash( oRs, ..... )
cJson := RsToJson( oRs, .... )
Re: ADO: load recordset into an Array
Posted: Sun Nov 17, 2019 8:17 am
by MOISES
Thank you. RsGetRows( oRs ) Works perfect.
Two more related questions please:
1.- Is there any other change to ADO stuff that must be aware of?
2.- Also there is the Hash approach: aArray1 := RsToHash( oRs )
Is this fastest?
Re: ADO: load recordset into an Array
Posted: Sun Nov 17, 2019 8:21 am
by nageswaragunupudi
2.- Also there is the Hash approach: aArray1 := RsToHash( oRs )
Is this fastest?
RsGetRows() is faster than RsToHash()