dbPutField()

Database function that changes a column (field) of the current data record.

Synopsis

int dbPutField(dbRecordset recordset, int index, anytype val);

Parameters

Parameter Meaning
recordset Record set reference
index Column number of the field, the first column has the index 0
val New content of the field

Return Value

The return value is an error code, 0 indicates successful execution of the operation. With other values detailed error information can be retrieved using dbGetError().

Errors

On transfer of an invalid record set reference variable, in the event of invalid column indices or if the data source or record set cannot be modified, an error is returned.

Description

The contents of the current data record are changed using dbPutField(). In the current implementation the following data types are correctly converted: bool, char, int, float, double, string, timevar. The convertibility to the external data types depends on the data source.

The dbPutField() method can only be used with the cursor types adOpenKeyset and adOpenDynamic (provided that the data source supports these types). To be able to make the changes to the data source yourself with dbPutField(), the dbUpdate() method should be executed. The first time dbPutField() is called after the record set is opened or after a navigation operation, the current data record in the data source is locked for changes made by other users (pessimistic locking).

Example

see dbAddNew()

Assignment

ADO, Database functions

Availability

CTRL