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

📄 read.pas

📁 数据库人寿保险通用系统 本系统主要负责保险资料的管理
💻 PAS
字号:
unit read;

interface

uses
  Classes,messages,dialogs,windows, SysUtils,Forms, Variants, Graphics, Controls;

type
  Tmythread = class(TThread)
  private
    { Private declarations }
  public
    procedure Execute; override;
    procedure cc;
    procedure backup;
  end;

implementation
  uses unit14,unit11;
{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure Tmythread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ Tmythread }
procedure tmythread.backup;//数据库备份
begin
  try
  with mydm.back do
  begin
    Close;
    SQL.Clear;
    SQL.Add('backup database ghyy to disk= '''+form14.Edit1.Text+'''');
    ExecSQL;
  end;
    Application.MessageBox('备份成功!','提示!',mb_ok);//接口加forms
    Form14.ProgressBar1.Position:=0;
    self.Terminate;
  except
    on e:exception do
      Application.MessageBox('备份失败!','提示!',mb_ok);
  end;
end;

procedure Tmythread.cc;//数据库还原
begin
  try
    try
      form14.Comindex:=form14.combobox1.ItemIndex;
      Form14.uu:=(strtoint(form14.cou)-form14.comindex);
      with mydm.back do
      begin
        Close;
        SQL.Clear;
        SQL.Add('use master restore database ghyy from disk= '''+Form14.edit2.text+''' with file=:a');
        Parameters.ParamByName('a').Value:=form14.uu;
        ExecSQL;
      end;
      Form14.Progressbar1.Position:=Form14.progressbar1.Max;
      Application.MessageBox('还原成功!','提示!',mb_ok);
      Form14.Progressbar1.Position:=0;
      self.Terminate; //终止线程
    except
      on e:exception do
        Application.MessageBox('还原失败!','提示!',mb_ok);
    end;
  Finally
    mydm.ADOConnection1.Close;
    with mydm.back do
    begin
      Close;
      SQL.Clear;
      SQL.Add('use ghyy'); //重新打开ghyy数据库
      ExecSQL;
    end;
  end;
end;
procedure Tmythread.Execute;
begin
  { Place thread code here }
  While form14.ProgressBar1.Position<Form14.ProgressBar1.Max do
    Form14.ProgressBar1.Position:=form14.ProgressBar1.Position+2;
end;

end.

⌨️ 快捷键说明

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