Cicode Programming Reference > Cicode Function Categories > Device Functions Introduction > DevControl

DevControl

Controls a dBASE or SQL device. You can pack a dBASE device to physically remove deleted records, or re-index a dBASE device to regenerate the keys. You can issue queries to an SQL device, or get the error status of the last SQL query.

Syntax

DevControl(hDev, Type [, sData])

hDev:

The device handle, returned from the DevOpen() function. The device handle identifies the table where all data on the associated device is stored.

Type:

The type of command:

0 - Re-index the device based on the key defined in the device record (dBASE devices only).

1 - Pack the database file - all deleted records are removed (dBASE devices only).

2 - Issue a direct SQL query to the device (SQL devices only).

3 - Get error status of the last SQL query (SQL devices only).

Note: ASCII files and printers are not supported.

sData:

The command data, that is the SQL query to be issued. Used only for Type 2 commands.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

DevOpen, DevZap

Example

! pack a dBASE file device
DevControl(hDev, 1, "");

See Also

Device Functions