Function DbZap() Foundation

Deletes all records in a work area.

Syntax
DbZap() --> NIL
Return

The return value of DbZap() is always NIL.

Description

DbZap() deletes all records in the work area and in any open index files. If memo fields are in use, the contents of the memo file are also deleted.

The function DbZap() should be used only with caution, since after it executes all records are permanently lost. They can no longer be recalled using DbRecall().

In a multi-user application (network operation) the file in the work area must be exclusively opened in order to execute DbZap(). Locking the file with FLock() is not sufficient to invoke DbZap().

The command ZAP can be used instead of DbZap(). ZAP is effective only in the current work area.

Examples
DbZap()
// The example shows the use of ZAP in a multi-user 
// application. The records of a temporary 
// transaction file are deleted. 

PROCEDURE Main 

   DO WHILE .T. 
      DbUseArea( .T.,,"Sales", "Sale", .F. ) 

      IF Neterr() .AND. ; 
         Alert( "File cannot be opened!" , ; 
                 {"Retry", "Cancel"} ) <> 2 
         LOOP 
      ENDIF 

      EXIT 
   ENDDO 

   IF Used() 
      DbZap() 
      DbCloseArea() 
   ENDIF 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.