<< Click to Display Table of Contents >> AdoServer:Delete() |
![]() ![]() ![]() |
Delete the current record
METHOD Delete ( ) CLASS AdoServer
LOGIC TRUE if successful; otherwise, FALSE
Delete() sends a NotifyIntentToMove message before the operation, and a NotifyDelete upon completion.
In contrast to the Dbserver:Delete method(), the deleted record can not be recovered.
Note
The behavior of the AdoServer class after the delete depends on the fact if there are clients attached to the server and on the current setting of SetDeleted():
- If SetDeleted() = TRUE and there are no clients the server automatically positions it self on the next valid record. If the last record was deleted the server moves to thenew last record
- If setDeleted() = FALSE or there are clients attached to the server, the server does not reposition itself. This is done because DataWindow and Databrowser clients will automatically move the server to a new record. If there are no clients attached the server will stay on the deleted line and will return empty values when fields are accessed and will return a record number of -1.
When the server was in AppendMode, this mode is cancelled and sends a NOTIFYRECORDCHANGE
In all other cases the Delete() method sends a NOTIFYFILECHANGE when completed. This is done because deleting records will change the number of records in the resultset and will also change the record numbers in the resultset.
When the Delete fails the server sends a NOTIFYRECORDCHANGE.
SetDeleted(FALSE)
oServer:GoTop()
? oServer:RECNO // 1
oServer:Delete()
? oServer:RECNO // -1
SetDeleted(TRUE)
oServer:GoTop()
? oServer:RECNO // 1
oServer:Delete()
? oServer:RECNO // 1 Because ADO
// automatically 'renumbers' the records after a delete
AdoServer, AdoRecordSet:Delete(), AdoServer:Append