?? usjhf.~pas
字號:
unit USJHF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ComCtrls, ExtCtrls;
type
TSJHF = class(TForm)
Image1: TImage;
ProgressBar1: TProgressBar;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
OpenDialog1: TOpenDialog;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
SJHF: TSJHF;
implementation
uses UDM;
{$R *.dfm}
procedure TSJHF.SpeedButton1Click(Sender: TObject);
{var
Str_Path:string;
begin
DM.ADOConn.Close;
DM.ADOConn.Connected:=False;
Opendialog1.Filter := '所有文件(*.*)|*.*';
Opendialog1.Title := '選擇恢復文件路徑和文件名';
if Opendialog1.Execute then
Str_Path:=opendialog1.FileName;
if Str_Path<>'' then
begin
with DM.Q do
begin
try
try
Screen.Cursor := crHourGlass;
DM.Q.Close;
DM.Q.SQL.Clear;
DM.Q.SQL.Add('use pubs restore DATABASE '+'CKGL'+ ' from DISK =''' +Str_Path+'''');
DM.Q.ExecSQL();
Screen.Cursor := crDefault;
Application.MessageBox('數據庫恢復成功完成!','數據庫恢復',0+mb_iconinformation);
except
Screen.Cursor := crDefault;
Application.MessageBox('數據庫恢復失敗!請檢查備份路徑或網絡狀態','數據庫恢復',0+mb_iconinformation);
exit;
end;
Finally
with DM.Qsjcsh do
begin
Close;
SQL.Clear;
SQL.Add('USE CKGL');
ExecSQL;
end;
end;
end;
end; }
var
path:string;
N:integer;
begin
DM.ADOConn.Close;
DM.ADOConn.Connected:=False;
self.Caption:='恢復數據';
messagebox(self.Handle,'請在恢復前將所有與該數據庫連接的程序關閉,以免恢復失敗','提示信息',mb_iconinformation);
opendialog1.Filter:='(備份文件)|*.bak';
opendialog1.InitialDir:=extractfiledir(application.ExeName)+'\databack\';
if opendialog1.Execute then
path:=opendialog1.FileName;
if path<>'' then
if messagebox(self.Handle,'確定要恢復數據庫嗎?這樣會覆蓋現在的數據。','提示信息',mb_yesno+mb_iconquestion)=idyes then
begin
self.Caption:='正在恢復數據...';
with DM.QSJHF do
begin
TRY
try
close;
SQL.Clear;
SQL.add('use master restore database CKGL from disk='+''''+ Trim(path)+'''');
ExecSQL();
for N:=0 to 100 do
progressbar1.Position:=N;
messagebox(self.Handle,'數據恢復成功','提示信息',mb_iconinformation);
Progressbar1.Position:=0;
except
messagebox(self.Handle,'數據恢復失敗','提示信息',mb_iconinformation);
end;
Finally
with DM.QSX do
begin
Close;
SQL.Clear;
SQL.Add('USE CKGL');
Open;
end;
end;
end;
end;
end;
procedure TSJHF.SpeedButton2Click(Sender: TObject);
begin
Close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -