如何对SQL Server进行备份和恢复 如何对SQL Server进行备份和恢复 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit dateC;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, shellapi, ComCtrls, ToolWin, ImgList, StdCtrls, jpeg, ADODB, ExtCtrls, Buttons, FileCtrl, DB;type TForm1 = class(TForm) PopupMenu1: TPopupMenu; CoolBar1: TCoolBar; ToolBar1: TToolBar; TB_server: TToolButton; TB_Dir: TToolButton; Menu_show: TMenuItem; Panel1: TPanel; Image1: TImage; ImageList1: TImageList; TB_copy: TToolButton; GroupBox1: TGroupBox; CB_copy: TCheckBox; Ed_cyc: TEdit; Label1: TLabel; SBar_Dir: TStatusBar; TB_save: TToolButton; TB_Hide: TToolButton; ADOC_copy: TADOCommand; ADOLink: TADOConnection; Timer1: TTimer; ToolButton1: TToolButton; ToolButton2: TToolButton; TB_Link: TToolButton; ProgressBar1: TProgressBar; TM_schedule: TTimer; Bevel1: TBevel; Memo1: TMemo; procedure FormHide(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure TB_serverClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); procedure TB_DirClick(Sender: TObject); procedure TB_saveClick(Sender: TObject); procedure TB_HideClick(Sender: TObject); procedure TB_copyClick(Sender: TObject); procedure Menu_showClick(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure CB_copyClick(Sender: TObject); procedure Ed_cycKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure TB_LinkClick(Sender: TObject); procedure TM_scheduleTimer(Sender: TObject); private { Private declarations } icondata:tnotifyicondata; //任务栏图标类型 copy_cycle:integer; //备分周期 protected { protected declarations } procedure wndproc(var msg:tmessage);override;//这个消息用于处理小图标的事件 public { Public declarations } end;var Form1: TForm1; implementationuses DFC;{$R *.dfm}const wm_xzz=wm_user+150; //自定消息 celltime=3600000; //单位时间 server_Dir='xzz_login'; //保存注册表的路径 server_Name='copy_server'; //保存的服务器名称 copy_Dir='copy_Dir'; //备份文件的路径 copy_Cyc='copy_cyc'; //自动备份周期 copy_check='copy_check'; //是否自动备份{ TForm1 }//**********************************************// 自定义函数//**********************************************procedure TForm1.wndproc(var msg: tmessage);var//这个消息用于处理小图标的事件 p:tpoint;begin case msg.Msg of wm_xzz: //在鼠标点击托盘图标时进行处理 case msg.LParam of wm_rbuttondown://单击右键 begin getcursorpos(p);//获取当前单击点的位置 popupmenu1.Popup(p.X,p.Y); end; wm_lbuttondown://单击左键 begin show; end; end; else end; inherited; end; //**********************************************// 初始化参数//**********************************************procedure TForm1.FormCreate(Sender: TObject);var S:string;begin//设置tnotifyicondata变量值 Left:=trunc((screen.Width-Width)/2); //在屏幕的中心显示窗体 Top:=trunc((screen.Height-Height)/2); TB_save.Enabled:=false; Timer1.Enabled:=false; TM_schedule.Enabled:=false; //定义托盘图标 icondata.cbSize:=sizeof(icondata); icondata.Wnd:=handle; icondata.uID:=100; icondata.uFlags:=nif_message+nif_icon+nif_tip; icondata.uCallbackMessage:=wm_xzz; icondata.hIcon:=application.Icon.Handle; strpcopy(icondata.sztip,caption); //以应用程序的标题作为图标提示 //读出登记注册的服务器 S:=DFC.U_readreg(server_Dir,server_Name); if S<>'NoregDir' then Memo1.Lines.Text:=S; //作出提示 //读出备份路径 S:=DFC.U_readreg(server_Dir,copy_dir); if S<>'NoregDir' then SBar_Dir.Panels.Items[1].Text:=s //作出提示 else DFC.U_writereg(server_Dir,copy_Dir,SBar_Dir.Panels.Items[1].Text); //保存默认备份路径 //读出备份周期 S:=DFC.U_readreg(server_Dir,copy_cyc); if S<>'NoregDir' then Ed_cyc.Text:=s //作出提示 else DFC.U_writereg(server_Dir,copy_Cyc,Ed_cyc.Text); //保存默认周期 //读出是自动备份 S:=DFC.U_readreg(server_Dir,copy_check); if S<>'NoregDir' then//作出提示 if S='T' then CB_copy.Checked:=true else CB_copy.Checked:=false; //服务器的联接的数据库 if memo1.Lines.Text<>'' then begin try ADOLink.Connected:=false; ADOLink.ConnectionString:=memo1.Lines.Text; ADOLink.Connected:=true; TB_Link.Down:=true; if CB_copy.Checked then //是否进行自动备份 begin Timer1.Interval:=strtoint(Ed_cyc.Text)*celltime; Timer1.Enabled:=true; ProgressBar1.Position:=1; TM_schedule.Interval:=round(Timer1.Interval/100); end; except TB_Link.Down:=false; CB_copy.Checked:=false; application.MessageBox('无法联接数据库,请通知管理人员!', '警告',MB_OK+MB_ICONWARNING); end; end; //向托盘中添加图标 shell_notifyicon(nim_add,@icondata); end; http://www.kaer.com.cn/default.aspx上提供了一个例子,对你回有用的 被fygnyyfr所要求.. 散分 COMBOBOX的问题 delphi程序怎么打包呀! 关于报表打印的问题 GDI元素保存为位图的问题. 我在用delphi6开发一个药品零售系统,销售小票采用套打,怎么写这个打印程序? 如何将两个exe文件一起编译?? 请教一个小问题,帮看看阿 加分 鼠标的使用! 怎样把一个变量的值变成含有两位小数的值,马上给分,在线 散分第一个10分,第二个20分,第三个70分
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, shellapi, ComCtrls, ToolWin, ImgList, StdCtrls, jpeg, ADODB,
ExtCtrls, Buttons, FileCtrl, DB;type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
TB_server: TToolButton;
TB_Dir: TToolButton;
Menu_show: TMenuItem;
Panel1: TPanel;
Image1: TImage;
ImageList1: TImageList;
TB_copy: TToolButton;
GroupBox1: TGroupBox;
CB_copy: TCheckBox;
Ed_cyc: TEdit;
Label1: TLabel;
SBar_Dir: TStatusBar;
TB_save: TToolButton;
TB_Hide: TToolButton;
ADOC_copy: TADOCommand;
ADOLink: TADOConnection;
Timer1: TTimer;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
TB_Link: TToolButton;
ProgressBar1: TProgressBar;
TM_schedule: TTimer;
Bevel1: TBevel;
Memo1: TMemo;
procedure FormHide(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure TB_serverClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TB_DirClick(Sender: TObject);
procedure TB_saveClick(Sender: TObject);
procedure TB_HideClick(Sender: TObject);
procedure TB_copyClick(Sender: TObject);
procedure Menu_showClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure CB_copyClick(Sender: TObject);
procedure Ed_cycKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TB_LinkClick(Sender: TObject);
procedure TM_scheduleTimer(Sender: TObject);
private
{ Private declarations }
icondata:tnotifyicondata; //任务栏图标类型
copy_cycle:integer; //备分周期
protected
{ protected declarations }
procedure wndproc(var msg:tmessage);override;//这个消息用于处理小图标的事件
public
{ Public declarations }
end;var
Form1: TForm1;
celltime=3600000; //单位时间
server_Dir='xzz_login'; //保存注册表的路径 server_Name='copy_server'; //保存的服务器名称
copy_Dir='copy_Dir'; //备份文件的路径
copy_Cyc='copy_cyc'; //自动备份周期
copy_check='copy_check'; //是否自动备份
{ TForm1 }
//**********************************************
// 自定义函数
//**********************************************
procedure TForm1.wndproc(var msg: tmessage);
var//这个消息用于处理小图标的事件
p:tpoint;
begin
case msg.Msg of
wm_xzz:
//在鼠标点击托盘图标时进行处理
case msg.LParam of
wm_rbuttondown://单击右键
begin
getcursorpos(p);//获取当前单击点的位置
popupmenu1.Popup(p.X,p.Y);
end;
wm_lbuttondown://单击左键
begin
show;
end;
end;
else
end;
inherited;
end;
//**********************************************
// 初始化参数
//**********************************************
procedure TForm1.FormCreate(Sender: TObject);
var S:string;
begin//设置tnotifyicondata变量值
Left:=trunc((screen.Width-Width)/2); //在屏幕的中心显示窗体
Top:=trunc((screen.Height-Height)/2);
TB_save.Enabled:=false;
Timer1.Enabled:=false;
TM_schedule.Enabled:=false;
//定义托盘图标
icondata.cbSize:=sizeof(icondata);
icondata.Wnd:=handle;
icondata.uID:=100;
icondata.uFlags:=nif_message+nif_icon+nif_tip;
icondata.uCallbackMessage:=wm_xzz;
icondata.hIcon:=application.Icon.Handle;
strpcopy(icondata.sztip,caption); //以应用程序的标题作为图标提示 //读出登记注册的服务器
S:=DFC.U_readreg(server_Dir,server_Name);
if S<>'NoregDir' then Memo1.Lines.Text:=S; //作出提示 //读出备份路径
S:=DFC.U_readreg(server_Dir,copy_dir);
if S<>'NoregDir' then SBar_Dir.Panels.Items[1].Text:=s //作出提示
else DFC.U_writereg(server_Dir,copy_Dir,SBar_Dir.Panels.Items[1].Text); //保存默认备份路径 //读出备份周期
S:=DFC.U_readreg(server_Dir,copy_cyc);
if S<>'NoregDir' then Ed_cyc.Text:=s //作出提示
else DFC.U_writereg(server_Dir,copy_Cyc,Ed_cyc.Text); //保存默认周期 //读出是自动备份
S:=DFC.U_readreg(server_Dir,copy_check);
if S<>'NoregDir' then//作出提示
if S='T' then CB_copy.Checked:=true else CB_copy.Checked:=false; //服务器的联接的数据库
if memo1.Lines.Text<>'' then
begin
try
ADOLink.Connected:=false;
ADOLink.ConnectionString:=memo1.Lines.Text;
ADOLink.Connected:=true;
TB_Link.Down:=true;
if CB_copy.Checked then //是否进行自动备份
begin
Timer1.Interval:=strtoint(Ed_cyc.Text)*celltime;
Timer1.Enabled:=true;
ProgressBar1.Position:=1;
TM_schedule.Interval:=round(Timer1.Interval/100);
end;
except
TB_Link.Down:=false;
CB_copy.Checked:=false;
application.MessageBox('无法联接数据库,请通知管理人员!', '警告',MB_OK+MB_ICONWARNING);
end;
end; //向托盘中添加图标
shell_notifyicon(nim_add,@icondata);
end;
上提供了一个例子,对你回有用的