|
AnyDAC
|
Compacts an Access database.
Use the Compact method to compact a database. To run Compact, an application must specify:
Optionally Encrypted, Password and SortOrder may be specified.
The file pointed by Database must be a valid .MDB file. DestDatabase can point to the same file as Database, in which case the file will be compacted into the same location. If DestDatabase names a different file than Database, the file named as the DestDatabase will be deleted at the time Compact is called. When the operation fails, then EMSAccessNativeException exception is raised.
procedure Compact;
// Compact non-secured database
ADMSAccessService1.Database := 'c:\test.mdb';
ADMSAccessService1.DestDatabase := 'c:\test2.mdb';
ADMSAccessService1.Compact;// Compact secured database
ADMSAccessService1.Database := 'c:\test.mdb';
ADMSAccessService1.Password := 'J@^^1234pw';
ADMSAccessService1.Compact;// Reset password of secured database
ADMSAccessService1.Database := 'c:\test.mdb';
ADMSAccessService1.Password := 'J@^^1234pw';
ADMSAccessService1.ResetPassword := True;
ADMSAccessService1.Compact;|
What do you think about this topic? Send feedback!
|