dbMove()

Database function which moves the data record pointer to any record in the record set relative to the current position.

Synopsis

int dbMove(dbRecordset recordset, int offset);

Parameters

Parameter Meaning
recordset Record set reference
offset Moves the record pointer relative to the current data record (the direction is specified by the sign)

Return Value

The return value is an error code; 0 indicates the operation has been performed successfully. For other values dbGetError() can be used to obtain detailed error information.

Errors

An error is returned if an invalid record set reference variable is passed, or if positioning in front of the first data record or after the last data record.

Description

dbMove() is called to change the current data record in a record set to another data record offset from the current data record. This method is only permitted for the cursor types adOpenKeyset, adOpenDynamic and adOpenStatic. The data source must allow backwards scrolling through the record set for negative offset parameters.

If the data record pointer is moved in front of the first data record or after the last record in the record set using dbMove(), the data record pointer is undefined and an error is returned. Before calling another record set method, the record set must be closed and re-opened.

One should note that unconfirmed changes (i.e. data fields changed by dbPutField() without dbUpate()) are automatically saved in the data source by an (internal) dbUpdate() call when the data record pointer is changed.

Example

see dbAddNew()

Assignment

ADO and Qt, Database functions

Availability

CTRL