Switch to: V12V11V10V9V8V7V6V5

VCursor Class: ODBC Navigation Methods

This group of methods implements “old good” style of records navigation in cursor (recordset). It provides shortest possible notation for move-forward after cursor creation, thanks to WHILE() loop.

It is important to remember, that these methods assume that the current position in cursor can be

  • BEFORE the first record
  • AFTER the last record

Right after the creation of a cursor the position is BEFORE the first record. So ( NextRecord_ODBC() ) will move us to the first record if it exists.

NOTE: Actually NextRecord_ODBC() method will be used in 99% cases. All the rest methods in this group was made just for symmetry with the main group of navigation methods of a Valentina Cursor.

NOTE: VCursor.EOF and Cursor.BOF properties are players of this group also.

VCursor.FirstRecord_ODBC()

Declaration:

FirstRecord_ODBC() as Boolean	

Description:

This form of FirstRecord() can work with “BEFORE THE FIRST” and “AFTER THE LAST” positions.

Go to the first logical record of a Cursor. Returns TRUE if the first record was found.

Example:

res = curs.FirstRecord_ODBC()

VCursor.LastRecord_ODBC()

Declaration:

This form of LastRecord() can work with “BEFORE THE FIRST” and “AFTER THE LAST” positions.

LastRecord_ODBC() as Boolean	

Description:

Go to the last record of a Cursor. Returns TRUE if the last record was found.

Example:

res = curs.LastRecord_ODBC()

VCursor.PrevRecord_ODBC()

This form of PrevRecord() can work with “BEFORE THE FIRST” and “AFTER THE LAST” positions.

Declaration:

PrevRecord_ODBC() as Boolean					

Description:

Go to the previous record of a Cursor if it exists.

  • Returns TRUE if the previous record is found (i.e. the current position was changed).
  • Returns FALSE if the current record was already the first or the Cursor is empty.

Example:

res = curs.PrevRecord_ODBC()

VCursor.NextRecord_ODBC()

NextRecord_ODBC() as Boolean

Description:

This form of NextRecord() can work with “BEFORE THE FIRST” and “AFTER THE LAST” positions.

Just after creation of a cursor, we are BEFORE the first record. So NextRecord_ODBC() moves us to the first record of cursor if it exists.

  • Returns TRUE if the next record is found (i.e. the current position was changed).
  • Returns FALSE if the current record was already the last or the Cursor is empty.

Example:

curs = db.SqlSelect( "SELECT * FROM T" )
while( curs.NextRecord_ODBC() )
{
   ...
}