⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 back1.pas

📁 湖滨小区物业管理系统主要是针对湖滨小区的物业管理公司作为使用对象而开发的
💻 PAS
字号:
unit back1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls,connectdlg, ComCtrls,  Buttons,ImgList,FileCtrl;

type
  Tback = class(TForm)
    GroupBox1: TGroupBox;
    Image1: TImage;
    Panel1: TPanel;
    GroupBox2: TGroupBox;
    Label1: TLabel;
    GroupBox3: TGroupBox;
    ComboBox1: TComboBox;
    Label2: TLabel;
    Edit1: TEdit;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    BitBtn1: TBitBtn;
    DirectoryListBox1: TDirectoryListBox;
    DriveComboBox1: TDriveComboBox;
    ListView1: TListView;
    FileListBox1: TFileListBox;
    Panel2: TPanel;
    ImageList1: TImageList;
    Panel3: TPanel;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  back: Tback;

implementation

{$R *.dfm}

procedure Tback.BitBtn1Click(Sender: TObject);
  var
     list:Tlistitem;
     a:integer;
     s:string;
     files:string;
begin
    if radiobutton1.Checked=true then
    begin
       if messagedlg('您确认要备份数据吗?',mtCustom,[mbyes,mbNo],0)=mryes then
    begin
    for a:=0  to listview1.Items.Count - 1 do
   begin
     if listview1.Items.Item[a].Caption=edit1.Text then
     begin
       showmessage('本路径下已有['+edit1.text+']备份卡.');
       exit;
       end;
      end;
      connect.ADOConnection1.Execute('backup database wuye'+combobox1.Text+'to disk='''
       +directorylistbox1.Directory+'\'+edit1.Text+'.mc''');
       list:=listview1.Items.Add;
       list.ImageIndex:=0;
       list.Caption:=edit1.Text;
       showmessage('备份完毕!!');
       end;
       end;
        if radiobutton2.Checked=true then
        begin
            if length(panel2.Caption)=0 then
            begin
            showmessage('请选择库文件存放的路径!');
            exit;
            end;
            if messagedlg('您确认要恢复数据吗?',mtcustom,[mbyes,mbNo],0)=mrYes then
            begin
               if Listview1.Items.Count=0 then
               begin
               Showmessage('对不起,没有发现备份卡,无法恢复数据.');
               exit;
               end
               else
               begin
                  if files='Nil' then
                  begin
                  showmessage('对不起,请重新选择要恢复的备份.');
                  exit;
                  end
                  else
                  begin
                    if length(directorylistbox1.Directory)>3 then
                      s:=directorylistbox1.Directory+'\'
                      else
                      s:=directorylistbox1.Directory;
                      connect.ADOConnection1.Execute('use master restore database'+combobox1.Text+'from disk='+''''+s+Files+'''');

                     connect.ADOConnection1.Execute('use'+combobox1.Text);
                     showmessage('恢复完毕!!');
       end;
       end;
     end;
   end;
   end;






end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -