DbfEncrypt

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

DbfEncrypt

Declaration

function DbfEncrypt: WordBool;

Description

Encrypts all records in a table (that have not as yet been encrypted) using the encoding key set via SetPassword.

 

Once SetPassword has been issued with an encoding key, records are auto matically encrypted when they are written, and automatically decrypted when they are read. Use DbfEncrypt to encrypt an existing un-encrypted table and/or use it to ensure that other xBase programs cannot read the table. One of the functions of DbfEncrypt is to alter the table header to make it incompatible with standard xBase programs.

 

The password used in encrypting the table must be set via SetPassword. If a password has not been set, no encrypting takes place.

 

The progress of the function may be visually monitored if a gauge hook has been set with SetGaugeHook.

 

The file should be opened for exclusive use before encrypting or decrypting.

Return Value

True if the function is successful and False if not.

Delphi Example

// Encrypt a table

with ApTbl do

begin

 SetPassword( 'Shazam' ); 

 if DbfEncrypt then

         ShowMessage( 'Database encrypting succeeded' ) 

 else  

         ShowMessage( 'Database encrypting failed' ); 

end;

C++Builder Example

// Decrypt an encrypted table

ApTbl->SetPassword( "Shazam" );

if (DbfEecrypt())

 ShowMessage( "Database encrypting succeeded" ); 

else

 ShowMessage( "Database encrypting failed" ); 

See Also

DbfDecrypt, SetGaugeHook, SetPassword