FW_DbfSqlQuery TOP y ORDER BY ASC no funciona

FW_DbfSqlQuery TOP y ORDER BY ASC no funciona

Postby VictorCasajuana » Mon Jun 28, 2021 8: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: Select all  Expand view

oRs := FW_DbfSqlQuery( '.\DBF', 'SELECT TOP 10 CODIGO,NOMBRE FROM ARTICULO ORDER BY NOMBRE DESC',,.t.)
xBrowse( oRs, Str( oRs:RecordCount() ) )

Resultado:
Image

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: Select all  Expand view

oRs := FW_DbfSqlQuery( '.\DBF', 'SELECT TOP 10 CODIGO,NOMBRE FROM ARTICULO ORDER BY NOMBRE ASC',,.t.)
xBrowse( oRs, Str( oRs:RecordCount() ) )

Resultado:
Image

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

Salud!
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs

Re: FW_DbfSqlQuery TOP y ORDER BY ASC no funciona

Postby nageswaragunupudi » Mon Jun 28, 2021 4:43 pm

Please try adding WHRE NOMBRE IS NOT NULL
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_DbfSqlQuery TOP y ORDER BY ASC no funciona

Postby VictorCasajuana » Mon Jun 28, 2021 5:21 pm

nageswaragunupudi wrote:Please try adding WHRE NOMBRE IS NOT NULL


This code work's fine:
Code: Select all  Expand view

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:
Image

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 ?
User avatar
VictorCasajuana
 
Posts: 194
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests