Re: Compact/Repair Access 2007 database



check this out: http://www.connectionstrings.com/?carrier=access2007

"Andy" <andy@xxxxxxxxx> wrote in message
news:47271e04$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Mike,

Thanks for responding and the code snippet. I tried it using the following
for SProvider1:

SProvider1 := 'Provider=Microsoft.ACE.OLEDB.12.0;Persist Security
Info=False;Jet OLEDB:Database Password=ppp;Jet OLEDB:New Database
Password=ppp;Data Source=' ;

But it gives me the following errors:

'Multiple-step OLE DB operation generated errors. Check each OLE DB status
value, if available. No work was done.'

Any idea where I went wrong?

Thanks again.

Andy

"MikeR" <nf4lNoSpam@xxxxxxxxx> wrote in message
news:47270ee2@xxxxxxxxxxxxxxxxxxxxxxxxx
Andy wrote:
What component should I get to compact and repair Access 2007 databases.
I used to use Adonis JRO to do this but it does not support .accdb 2007
files.
Thanks in advance.

Andy
Import the type library from msjro.dll
Then
procedure TfrmLog.mnuCompactDBClick(Sender: TObject);
var
wholePath: string;
JE: TJetEngine;
begin
wholePath := WritePath + FOLDER_NAME + DBName;
if FileExists(WritePath + FOLDER_NAME + 'compacted.mdb') then
DeleteFile(WritePath + FOLDER_NAME + 'compacted.mdb');
if FileExists(wholePath) then
begin
//close the database here
JE:= TJetEngine.Create(Application);
try
try
JE.CompactDatabase(SProvider1 + wholePath, SProvider1 + WritePath
+ FOLDER_NAME + 'compacted.mdb');
except
on E:Exception do
ShowMessage(E.Message);
end;
finally
JE.FreeOnRelease;
if FileExists(WritePath + FOLDER_NAME + 'compacted.mdb') then
begin
DeleteFile(wholepath);
RenameFile(WritePath + FOLDER_NAME + 'compacted.mdb', wholepath);
// reopen the database
end;
end;
end;

Mike



.



Relevant Pages

  • Re: Compact/Repair Access 2007 database
    ... Thanks for responding and the code snippet. ... for SProvider1: ... 'Multiple-step OLE DB operation generated errors. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Compact/Repair Access 2007 database
    ... for SProvider1: ... SProvider1:= 'Provider=Microsoft.ACE.OLEDB.12.0;Persist Security ... 'Multiple-step OLE DB operation generated errors. ... //close the database here ...
    (borland.public.delphi.thirdpartytools.general)
  • Pull method for sqlceremotedataaccess
    ... catch (SqlCeException ce) ... private static void CreateDatabase() ... // Pull down the authors table from the pubs database on the remote ... internetUrl in the code snippet without any error ...
    (microsoft.public.sqlserver.ce)
  • pull method
    ... catch (SqlCeException ce) ... private static void CreateDatabase() ... // Pull down the authors table from the pubs database on the remote ... internetUrl in the code snippet without any error ...
    (microsoft.public.sqlserver.replication)
  • Re: Populate dataset with text file
    ... I have found this code snippet on about.com, but it does not work for me ... Connect a TADOCommand to your database using the ConnectionString or the ... >> populate a memo control in less than a second. ...
    (borland.public.delphi.database.ado)