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

📄 udatabak.pas

📁 说明: 比较简单的人事档案管理程序,包含了人事档案的大部分功能,做人事档案的兄弟可以看看. 本程序类型:delphi7 + Access2000 桌面数据库 初始用户名/密码:admin
💻 PAS
字号:
unit UDataBak;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TForm_DataBak = class(TForm)
    ProgressBar1: TProgressBar;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    procedure Databakcopy(a, b: string);
  public
    { Public declarations }
  end;

var
  Form_DataBak: TForm_DataBak;

implementation
uses Umain;
{$R *.dfm}

procedure TFORM_DataBak.Databakcopy(a, b: string);
var
  T1, T2: file of byte;
  lin: array[0..10] of char;
  i: integer;
  length: longint;
begin
  progressbar1.Visible := true;
  assignfile(T1, a);
  reset(T1);
  assignfile(T2, b);
  rewrite(T2);
  length := filesize(T1);
  with progressbar1 do
  begin
    min := 0;
    max := length;
    while length > 0 do
    begin
      blockread(T1, lin[0], sizeof(lin), i);
      length := length - i;
      blockwrite(T2, lin[0], i);
      position := position + i * 100;
    end;
    closefile(T1);
    closefile(T2);
  end;
end;

procedure TForm_DataBak.Button2Click(Sender: TObject);
begin
  close;
end;

procedure TForm_DataBak.Button1Click(Sender: TObject);
var file1, file2: string;
begin
  file1 := Form_Main.AppPath + 'data\adjt.mdb';
  file2 := Form_Main.AppPath + 'data\adjt.bak';
  if Button1.Caption = '开始备份' then
  begin
    try
      Databakcopy(file1, file2);
      showmessage('备份成功!');
    except
      showmessage('备份失败!');
    end;
    close;
  end
  else
  begin
    if (MessageDlg('确定要还原上次备份的内容吗?你的操作不可恢复!', mtConfirmation, [mbYes, mbNo], 0))
      = mrYes then
    begin
      try
        Databakcopy(file2, file1);
        showmessage('数据还原成功')
      except
        showmessage('还原失败!');
      end;
    end;
    close;
  end;
end;
end.

⌨️ 快捷键说明

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