if BackupDialog.Execute then begin filePath := BackupDialog.FileName; end; if length (filePath) < 4 then exit; if Ado_Backup.Active then Ado_Backup.Close; Ado_Backup.SQL.Clear; Ado_Backup.SQL.Add('RESTORE DATABASE hxxt from disk = ' + '''' + filePath + ''''); try if not dm.ADOConnection1.Active then dm.ADOConnection1.Active := true; //////////// ******************* Ado_Backup.ExecSQL; except MessageDlg('数据恢复不成功!', mtInformation, [mbOK], 0); exit; end; MessageDlg('数据恢复成功!', mtInformation, [mbOK], 0);
begin
filePath := BackupDialog.FileName;
end;
if length (filePath) < 4 then exit; if Ado_Backup.Active then Ado_Backup.Close;
Ado_Backup.SQL.Clear; Ado_Backup.SQL.Add('RESTORE DATABASE hxxt from disk = ' +
'''' + filePath + '''');
try
if not dm.ADOConnection1.Active then
dm.ADOConnection1.Active := true; //////////// *******************
Ado_Backup.ExecSQL;
except
MessageDlg('数据恢复不成功!', mtInformation, [mbOK], 0);
exit;
end;
MessageDlg('数据恢复成功!', mtInformation, [mbOK], 0);