ADO: load recordset into an Array

Post Reply
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

ADO: load recordset into an Array

Post 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.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
leandro
Posts: 958
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia
Contact:

Re: ADO: load recordset into an Array

Post by leandro »

Una idea

Code: Select all

hData := RsToHash( oRsClientes)
 
Saludos
LEANDRO ALFONSO
SISTEMAS LYMA - BASE
Bogotá (Colombia)
[ FWH 19.09 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613) ] [ Embarcadero C++ 7.30 for Win32 ]
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: ADO: load recordset into an Array

Post 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,
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ADO: load recordset into an Array

Post 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

Code: Select all

aData := oRs:GetRows()
 
as

Code: Select all

aData := RsGetRows( oRs )
 
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, .... )
 
Regards

G. N. Rao.
Hyderabad, India
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Re: ADO: load recordset into an Array

Post 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?
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: ADO: load recordset into an Array

Post by nageswaragunupudi »

2.- Also there is the Hash approach: aArray1 := RsToHash( oRs )

Is this fastest?
RsGetRows() is faster than RsToHash()
Regards

G. N. Rao.
Hyderabad, India
Post Reply