begin
pgbar.Max:=100;
pgbar.Min:=0;
pgbar.Step:=20;
adoconnection1.Close;
if adoconnection1.Connected then
begin
application.MessageBox('数据库数据正在使用','系统提示')
end
else
begin
try
adocommand1.CommandText:='use master';
pgbar.StepIt;
adocommand1.Execute ;
adocommand1.CommandText:='execute sp_helpdevice';
pgbar.StepIt;
adocommand1.Execute ;
pgbar.stepit;
adocommand1.CommandText:='backup database docmanage to disk=''c:\ccc.bak'' with init';
pgbar.StepIt;
adocommand1.Execute ;
adocommand1.CommandText:='backup log docmanage to ccc';
pgbar.StepIt;
adocommand1.Execute;
try
aDOConnection1.Connected:=true;
except
ShowMessage('无法连接指定的数据库!');
application.Terminate;
end;
form1.Hide;
if messagedlg('数据库docmanage已成功备份到c:\ccc.bak!是否继续?',mtwarning,[mbok],0)=mrok then
begin
form1.close
end;
except
on exception do
if ADOConnection1.InTransaction then
ADOConnection1.RollbackTrans
end;
end;
end;