Click or drag to resize

DbDelete Function

X#
Mark the current record for deletion.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbDelete() AS LOGIC
Request Example View Source

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
Records marked for deletion can be filtered using SetDeleted() or removed from the file using DBPack(). By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
DBDelete() is the functional equivalent of the DELETE command with a scope of the current record.
For more information, refer to DELETE.
Tip Tip
Logical records: If SetDeleted() is TRUE, deleted records are not logically visible. That is, database operations which operate on logical records will not consider records marked for deletion. Note, however, that if SetDeleted() is TRUE when the current record is marked for deletion, the record remains visible until it is no longer the current record. Shared mode: For a shared database, DBDelete() requires the current record to be locked.
Examples
The following example deletes a record after a successful record lock:
X#
 1cLast := "Winston"
 2DBUseArea(TRUE, "DBFNTX", "sales", "Sales", TRUE)
 3Sales->DBSetIndex("LastName")
 4IF Sales->DBSeek(cLast)
 5    IF Sales->RLock()
 6        Sales->DBDelete()
 7        QOut("Record deleted: ", Sales->Deleted())
 8    ELSE
 9        QOut("Unable to lock record...")
10    ENDIF
11ELSE
12    QOut("Not found")
13ENDIF
See Also