Function AX_DBFEncrypt() Professional

Encryption of a table.

Syntax
AX_DBFEncrypt() --> lSuccess
Return

This function returns the logical value .T. if the file is successfully encrypted. It returns .F. if the encryption failed. On a failure of the operation, the methods :getLastError() and :getLastMessage() of the DacSession object can be used to obtain information about the reason of the failure.

Description

The function AX_DBFEncrypt() will encrypt a table using the password set with the AX_SetPass() function (or its command opponent).

A file must be opened in EXCLUSIVE mode for data encryption.

Examples
#include "ads.ch" 


// Install ADSDBE as default database engine. 
PROCEDURE DbeSys 
   IF !DbeLoad( "ADSDBE" ) 
      Alert( "ADSDBE could not be installed!" ) 
   ENDIF 
   DbeSetDefault( "ADSDBE" ) 
RETURN 


PROCEDURE Main 
   // Connect to database server. 
   LOCAL cConnect := "DBE=ADSDBE;SERVER=\\ALASKA\VOL1" 
   LOCAL oSession := DacSession():new( cConnect ) 

   IF .NOT. oSession:isConnected() 
      Alert( "Connection to server could not be established!" ) 
      QUIT 
   ENDIF 


   // Open TEST.DBF, set a password for this workarea and 
   // encrypt the table. 
   USE Test NEW EXCLUSIVE 
   AX_SetPass( "Hobbit" ) 

   IF AX_DBFEncrypt() 
      ? "Encryption ok." 
   ELSE 
      ? "Encryption FAILED!" 
   ENDIF 

   // Close databases and disconnect from server. 
   DbCloseAll() 
   oSession:disconnect() 
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.