FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour FW_DbfSqlQuery TOP y ORDER BY ASC no funciona
Posts: 309
Joined: Wed Mar 28, 2018 04:38 PM
FW_DbfSqlQuery TOP y ORDER BY ASC no funciona
Posted: Mon Jun 28, 2021 08:33 AM
Hola.

Estoy realizando pruebas para trabajar con ADO los ficheros DBF y me está funcionando todo salvo la combinación de TOP y ORDER BY ASC

El siguiente código funciona bien ya que el RecordCount del RecordSet devuelve 10 que es el TOP que se le indica:
Code (fw): Select all Collapse
oRs := FW_DbfSqlQuery( '.\DBF\', 'SELECT TOP 10 CODIGO,NOMBRE FROM ARTICULO ORDER BY NOMBRE DESC',,.t.)
xBrowse( oRs, Str( oRs:RecordCount() ) )

Resultado:


Pero si cambio el tipo de orden, el recordset no devuelve el RecordCount correcto, ya que igualmente tendría que ser 10 al indicarle TOP 10:
Code (fw): Select all Collapse
oRs := FW_DbfSqlQuery( '.\DBF\', 'SELECT TOP 10 CODIGO,NOMBRE FROM ARTICULO ORDER BY NOMBRE ASC',,.t.)
xBrowse( oRs, Str( oRs:RecordCount() ) )

Resultado:


Estoy haciendo algo mal o la función FW_DbfSqlQuery no funciona correctamente?

Salud!
--------

¿ Y porque no ?

¿ And why not ?
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_DbfSqlQuery TOP y ORDER BY ASC no funciona
Posted: Mon Jun 28, 2021 04:43 PM

Please try adding WHRE NOMBRE IS NOT NULL

Regards



G. N. Rao.

Hyderabad, India
Posts: 309
Joined: Wed Mar 28, 2018 04:38 PM
Re: FW_DbfSqlQuery TOP y ORDER BY ASC no funciona
Posted: Mon Jun 28, 2021 05:21 PM
nageswaragunupudi wrote:Please try adding WHRE NOMBRE IS NOT NULL


This code work's fine:
Code (fw): Select all Collapse
cQuery := 'SELECT TOP 10 CODIGO,NOMBRE FROM ARTICULO WHERE NOMBRE IS NOT NULL ORDER BY NOMBRE ASC'
oRs := FW_DbfSqlQuery( '.\DBF\', cQuery,,.t.)
xBrowse( oRs, 'RecCount:' + Str( oRs:RecordCount() ) )


result:


so for the ASC parameter to work, do I have to put WHERE IS NOT NULL to the index field?
--------

¿ Y porque no ?

¿ And why not ?

Continue the discussion