Delphi kullanarak MS-Access Veri Tabanının Sıkıştırılması - Onarılması

by admin,

# veri tabanını uygulama içinde sıkıştırmaya ve onarmaya yarıyor.
# data base and to repair injuries to the application is the compression.
# D6-BDS2006-CG2007

PHP Kodu:
CompactAndRepair(sOldMDB : String; sNewMDB : String) : Boolean;
const
sProvider = ‘Provider=Microsoft.Jet.OLEDB.4.0;’;
var
oJetEng : JetEngine;
begin
sOldMDB
:= sProvider + ‘Data Source=’ + sOldMDB;
sNewMDB := sProvider + ‘Data Source=’ + sNewMDB;

try
oJetEng := CoJetEngine.Create;
oJetEng.CompactDatabase(sOldMDB, sNewMDB);
oJetEng := Nil;
Result := True;
except
oJetEng
:= Nil;
Result := False;
end;
end;

if CompactAndRepair(‘e:\Old.mdb’, ‘e:\New.mdb’) then
ShowMessage
(‘İşlem Başarılı.’)
else
ShowMessage(‘İşlemde Hata Oluştu.’);

# Önemli Not:
1- JRO_TLB unit ini uses bölümüne ekleyin.
2- Database sıkıştırılırken kimse database i açıp kullanmamalıdır.
3- Eðer JRO_TLB unit i ile ilgili hata verirse aşağıdakileri yapın
a) menüsünde Project - Import Type Library i seçin
b) “Microsoft Jet and Replication Objects 2.1 Library” i bulun.
c) Install butonunu tıklayın.
d) Programınızı tekrar derleyin

# Important Note:
1 - JRO_TLB unit will add to the uses section.
2 - Database compression are open and i should not use one database.
3 - If i JRO_TLB unit gives the following error related to
a) menu Project - Select Import Type Library
b) “Microsoft Jet and Replication Objects 2.1 Library” i found.
c) Click the Install button.
d) Compile your program again

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.

Oyun Domain Registration Australia
Add to Technorati Favorites Technorati