procedure TFormMain.RestorDateClick(Sender: TObject);
var
MyFileName, aa: string;
begin
MyFileName := '';
try
if OpenDialog1.Execute then
begin
MyFileName := OpenDialog1.FileName;
if MyFileName <> '' then
begin
aa := ExtractFilePath(Application.ExeName) + 'HYTJ.mdb';
if CopyFile(Pchar(MyFileName),Pchar(aa), false) then
begin
DM.ADOConnect.Close;
DM.ADOConnect.Open;
Application.MessageBox('数据恢复成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据恢复失败','提示',Mb_ok + mb_iconError);
end;
end;
procedure TFormMain.BackupDataClick(Sender: TObject);
var
MyFileName: string;
begin
MyFileName := '';
try
if SaveDialog1.Execute then
begin
MyFileName := SaveDialog1.FileName;
if MyFileName <> '' then
begin
if CopyFile(Pchar(ExtractFilePath(Application.ExeName) + 'HYTJ.mdb'), Pchar(MyFileName), false) then
begin
Application.MessageBox('数据备份成功','提示',Mb_ok + mb_iconinformation);
end;
end;
end;
except
Application.MessageBox('数据备份失败','提示',Mb_ok + mb_iconError);
end;
end;