📄 db_backupdestination.pas
字号:
unit DB_BackupDestination;
{
代码单元名称:通用数据库备份工具备份设备选择窗口
从属软件:大连资金清算中心打码机管理信息系统
开发单位:大连理工大学计算机技术研究所软件工程研究室
作者:王树润
时间:2001,1,30
}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TDB_DfmBackupDestination = class(TForm)
DestinationComboBox: TComboBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
DiskRadioButton: TRadioButton;
DestinationListBox: TListBox;
MyServerName: string;
constructor Create(Owner: TComponent; ADiskRadioButton: TRadioButton;
ADestinationListBox: TListBox; AMyServerName: string);
end;
implementation
uses DB_DataModule1, DB_SetDestination, PublicUnit;
{$R *.DFM}
//构造函数======================================================================
constructor TDB_DfmBackupDestination.Create(Owner: TComponent;
ADiskRadioButton: TRadioButton;
ADestinationListBox: TListBox; AMyServerName: string);
begin
inherited Create(Owner);
DiskRadioButton := ADiskRadioButton;
DestinationListBox := ADestinationListBox;
MyServerName := AMyServerName;
end;
//窗体==========================================================================
procedure TDB_DfmBackupDestination.FormShow(Sender: TObject);
begin
DB_DfmDataModule1.ADOConnection1.ConnectionString :=
'Provider=SQLOLEDB.1;Persist Security Info=False;User ID=' +
PublicUnit.DbUser
+ ';Password=' + PublicUnit.DbPass + ';Initial Catalog=master;Data Source='
+
PublicUnit.ServerName;
with DB_DfmDataModule1.ADOQuery1 do
begin
Close;
Sql.Clear;
if DiskRadioButton.Checked = True then
Sql.Add('Select * From sysdevices where cntrltype=2');
try
open;
except
ShowMessage('error');
Exit;
end;
end;
while not DB_DfmDataModule1.ADOQuery1.Eof do
begin
DestinationComboBox.Items.Add(DB_DfmDataModule1.ADOQuery1.FieldByName('name').AsString);
DB_DfmDataModule1.ADOQuery1.Next;
end;
DestinationComboBox.ItemIndex := 0;
end;
procedure TDB_DfmBackupDestination.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DB_DfmDataModule1.ADOQuery1.Close;
DB_DfmDataModule1.ADOConnection1.Close;
end;
//关闭==========================================================================
procedure TDB_DfmBackupDestination.Button2Click(Sender: TObject);
begin
Close;
end;
//添加备份设备==================================================================
procedure TDB_DfmBackupDestination.Button1Click(Sender: TObject);
begin
if DestinationListBox.Items.IndexOf(DestinationComboBox.Text) = -1 then
DestinationListBox.Items.Add(DestinationComboBox.Text);
DB_DfmDataModule1.ADOQuery1.Close;
DB_DfmDataModule1.ADOConnection1.Close;
Close;
end;
//新建备份设备==================================================================
procedure TDB_DfmBackupDestination.Button3Click(Sender: TObject);
var
DB_DfmSetDestination: TDB_DfmSetDestination;
begin
DB_DfmDataModule1.ADOConnection1.Close;
DB_DfmSetDestination := TDB_DfmSetDestination.Create(Self, MyServerName,
DestinationComboBox);
DB_DfmSetDestination.ShowModal;
DB_DfmSetDestination.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -