Using Delphi Firedac to compact and repair a MS Access Database.

Rad Studio Delphi Development
Over the years Delphi Firedac continues to grow as a robust programming language. Delphi Firedac provides a new way to compact and repair a database. The tools provide developers with components or services that create superb applications. Delphi Firedac provides a unique set of Universal Data Access Components for developing multi-device database applications. This will show the older method of compacting and repairing MS Access databases. The code listed below demonstrates the process. Very straight forward you need to create the object, populate the commands and you are ready to go. function CompactAndRepair(DB: string): Boolean; var v: OLEvariant; begin Result := True; try v := CreateOLEObject('JRO.JetEngine'); try V.CompactDatabase('Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DB, 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+DB+'compacted;Jet OLEDB:Engine Type=5'); DeleteFile(DB); RenameFile(DB+'compacted',DB); finally V := Unassigned; end; except Result := False; end; end; Delphi Firedac now has…
Read More