P
pokar
Unregistered / Unconfirmed
GUEST, unregistred user!
两个都是备份与压缩不成功!!!
procedure TMainForm.ESimageFM12Click(Sender: TObject);
var
X: OleVariant;
sourcefiles,tempfiles,ole_tmp:string;
begin
dm1.ADO1.Connected:=False;
mainform.Dconnent.Connected:=False;
X:=createoleobject('JRO.JetEngine');
sourcefiles:=extractfilepath(application.exename)+'hy.mdb';
tempfiles:=extractfilepath(application.exename)+'temp.mdb';
StatusBar1.Panels[4].Text:='正在压缩数据...';
try
x.CompactDatabase(sourcefiles,tempfiles,ole_tmp,ole_tmp,';pwd=123');
deletefile(sourcefiles);
renamefile(tempfiles,sourcefiles);
StatusBar1.Panels[4].Text:='压缩数据完毕!';
if fileExists(sourcefiles) and FileExists(tempfiles) then
if deleteFile(sourcefiles)then
RenameFile(tempfiles,sourcefiles);
except
Messagedlg('主数据库正在被他人或应用程序使用,请稍后再试!',mtwarning,[mbok],0);
end;
dm1.ADO1.Connected:=True;
mainform.Dconnent.Connected:=True;
end;
procedure TMainForm.ESimageFM10Click(Sender: TObject);
var p,qchar;
begin
dm1.ADO1.Connected:=False;
mainform.Dconnent.Connected:=False;
if fileexists(extractfilepath(Application.ExeName)+'hy.mdb') then
begin
p:=pchar(extractfilepath(application.exename)+'backup.dat');
q:=pchar(StatusBar1.Panels[4].Text);
if CopyFile(p,q,true) then
Application.MessageBox('数据备份成功!','提示',MB_ICONINFORMATION + MB_OK)
else
Application.MessageBox('数据备份失败,请重新备份!','提示',MB_ICONINFORMATION + MB_OK);
end;
dm1.ADO1.Connected:=True;
mainform.Dconnent.Connected:=True;
end;
procedure TMainForm.ESimageFM12Click(Sender: TObject);
var
X: OleVariant;
sourcefiles,tempfiles,ole_tmp:string;
begin
dm1.ADO1.Connected:=False;
mainform.Dconnent.Connected:=False;
X:=createoleobject('JRO.JetEngine');
sourcefiles:=extractfilepath(application.exename)+'hy.mdb';
tempfiles:=extractfilepath(application.exename)+'temp.mdb';
StatusBar1.Panels[4].Text:='正在压缩数据...';
try
x.CompactDatabase(sourcefiles,tempfiles,ole_tmp,ole_tmp,';pwd=123');
deletefile(sourcefiles);
renamefile(tempfiles,sourcefiles);
StatusBar1.Panels[4].Text:='压缩数据完毕!';
if fileExists(sourcefiles) and FileExists(tempfiles) then
if deleteFile(sourcefiles)then
RenameFile(tempfiles,sourcefiles);
except
Messagedlg('主数据库正在被他人或应用程序使用,请稍后再试!',mtwarning,[mbok],0);
end;
dm1.ADO1.Connected:=True;
mainform.Dconnent.Connected:=True;
end;
procedure TMainForm.ESimageFM10Click(Sender: TObject);
var p,qchar;
begin
dm1.ADO1.Connected:=False;
mainform.Dconnent.Connected:=False;
if fileexists(extractfilepath(Application.ExeName)+'hy.mdb') then
begin
p:=pchar(extractfilepath(application.exename)+'backup.dat');
q:=pchar(StatusBar1.Panels[4].Text);
if CopyFile(p,q,true) then
Application.MessageBox('数据备份成功!','提示',MB_ICONINFORMATION + MB_OK)
else
Application.MessageBox('数据备份失败,请重新备份!','提示',MB_ICONINFORMATION + MB_OK);
end;
dm1.ADO1.Connected:=True;
mainform.Dconnent.Connected:=True;
end;