Page 1 of 1

Position in ADO Recordset

PostPosted: Sat Jun 10, 2023 11:50 pm
by Jimmy
hi,

i can use ADO Method MoveFirst, MoveLast, MoveNext and MovePrevious to move to a Position but how to get the actual "Position" in ADO Recordset :?:
RECNO() does not work with EXCEL ...

how to find out how many ROW Recordset have :?:

Re: Position in ADO Recordset

PostPosted: Sun Jun 11, 2023 1:13 am
by Cgallegoa
Jimmy,

Equivalents:
    Found() --> .not. oRs:Eof()
    RecNo() --> oRs:BookMark
    DbGoTo( n ) --> oRs:BookMark := n
    OrdKeyNo() --> oRs:AbsolutePosition
    OrdKeyGoTo( x ) --> oRs:AbsolutePosition := x
Regards,

Re: Position in ADO Recordset

PostPosted: Sun Jun 11, 2023 1:13 am
by nageswaragunupudi
oRs:BookMark --> is like RECNO() of DBF
oRs:AbsolutePosition --> is like OrdKeyNo() of DBF

After reading a recordset, both point to the same record.

After reading a recordset, we can sort the recordset in memory by
Code: Select all  Expand view
oRs:Sort := cFieldName


After sorting, oRs:BookMark points to the record number in the original order as read where as oRs:AbsolutePosition points to the relative position in the sorted order.

Usage:
Code: Select all  Expand view
uBm := oRs:BookMark
oRs:BookMark := 50.0
n := oRs:AbsolutePostion
oRs:AbolutePostion := 20


https://www.w3schools.com/asp/ado_intro.asp

Re: Position in ADO Recordset

PostPosted: Sun Jun 11, 2023 3:42 am
by Jimmy
hi,
nageswaragunupudi wrote:After sorting, oRs:BookMark points to the record number in the original order as read where as oRs:AbsolutePosition points to the relative position in the sorted order.

ah, understand

thx for all Answer