HELP - compress and repair Access db in Delphi not working?
From: jason (jason_at_noreplies.com)
Date: 02/25/05
- Next message: Brian Bushay TeamB: "Re: TAdoData Master Detail Relationships"
- Previous message: Rob Roberts: "Re: ADO + CoInitialize in threads? Mystery..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Feb 2005 17:41:54 -0800
Hi all,
I have a function that gets passed the location of a MS Access
database (copy of entire function below), it then is supposed to
compress and repair the database. However I keep getting
"EOleException ..class not registered" exception on the line
V.CompactDatabase(.....);
Your help would be greatly appreciated! :)
Function is below..
=========================================
function TfrmMaintenance.CompactAndRepair(DB: string): Boolean; {DB = Path to Access Database}
var
v: OLEvariant;
begin
Result := True;
try
if FileExists(ExtractFilePath(Application.ExeName) + 'TRegSvr.exe') then
begin
ShellExec( Application.Handle, '', ExtractFilePath(Application.ExeName) + 'TRegSvr.exe', '-q C:\Program Files\Common Files\System\ADO\msjro.dll', ExtractFilePath(Application.ExeName), SW_HIDE);
end;
v := CreateOLEObject('JRO.JetEngine');
try
V.CompactDatabase('Provider=Microsoft.Jet.4.0;Data Source='+DB+';Mode=Share Deny None;Persist Security Info=false;Jet OLEDB:Engine Type=5;Database Password=xxxxxxxx'
,'Provider=Microsoft.Jet.4.0;Data Source='+DB+'x;Mode=Share Deny None;Persist Security Info=false;Jet OLEDB:Engine Type=5;Database Password=xxxxxxxx');
Result := true;
// DeleteFile(DB);
// RenameFile(DB+'x',DB);
finally
V := Unassigned;
end;
except
Result := False;
end;
end;
- Next message: Brian Bushay TeamB: "Re: TAdoData Master Detail Relationships"
- Previous message: Rob Roberts: "Re: ADO + CoInitialize in threads? Mystery..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|