u_wjhf.pas
来自「人事管理程序源码」· PAS 代码 · 共 172 行
PAS
172 行
unit U_wjhf;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls,ADODB, ComCtrls;
type
TForm_SJhf = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
OpenDialog1: TOpenDialog;
Panel5: TPanel;
Panel6: TPanel;
S_URL: TLabel;
D_URL: TLabel;
SaveDialog1: TSaveDialog;
Panel7: TPanel;
PrbCopy: TProgressBar;
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure copyFile(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_SJhf: TForm_SJhf;
implementation
uses U_gzda_dm, U_main;
{$R *.dfm}
procedure TForm_SJhf.BitBtn3Click(Sender: TObject);
begin
OpenDialog1.Execute;
if OpenDialog1.Files.Count<>0 then
s_URl.Caption:=OpenDialog1.Files.Strings[0];
end;
procedure TForm_SJhf.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm_SJhf.BitBtn4Click(Sender: TObject);
begin
SaveDialog1.Execute;
if SaveDialog1.Files.Count<>0 then
D_URl.Caption:=SaveDialog1.Files.Strings[0];
end;
procedure TForm_SJhf.FormShow(Sender: TObject);
var
s,d:string;
begin
with gzda_dm.ADODataSet1 do begin
if active then active:=false;
commandtext:='select * from xtsz';
open;
if recordcount=0 then
begin
append;
UpdateBatch(arALL);
end;
first;
s:=fieldbyname('D_URL').AsString;
D:=fieldbyname('S_URL').AsString;
end;
s_URL.Caption:=s;
D_URL.Caption:=Form_main.xt_dir;
panel4.Refresh;
end;
procedure TForm_SJhf.BitBtn1Click(Sender: TObject);
var
s,d:string;
SrcFile,DestFile:File;
BytesRead,BytesWritten,ToTalRead:Integer;
Buffer:Array[1..500] of byte;
Fsize:integer;
begin
panel7.Visible:=true;
s:=S_URL.Caption;
d:=D_URL.Caption;
if s='' then
begin
showmessage('请选择源文件名!!');
abort;
end;
if D='' then
begin
showmessage('请选择目标文件名!!');
abort;
end;
with gzda_dm.ADODataSet1 do begin
first;
edit;
fieldbyname('s_URL').AsString:=s;
//fieldbyname('d_URL').AsString:=d;
post;
UpdateBatch(arALL);
end;
AssignFile(SrcFile,S);
AssignFile(DestFile,D);
ReSet(SrcFile,1);
try
Rewrite(destFile,1);
try
try
TotalRead:=0;
Fsize:=filesize(SrcFile);
repeat
BlockRead(SrcFile,Buffer,Sizeof(Buffer),BytesRead);
if BytesRead>0 then
begin
BlockWrite(DEStFile,Buffer,BytesRead,BytesWritten);
if BytesRead<>BytesWritten then
Raise Exception.Create('文件拷贝出错!!')
else
begin
ToTalRead:=ToTalRead+BytesRead;
Prbcopy.Position:=Trunc(TotalRead/FSize)*100;
PrbCopy.Update;
end;
end ;
until bytesRead=0;
except
Erase(DestFile);
Raise;
end;
finally
CloseFile(DestFile);
end;
Finally
CloseFile(SrcFile);
end;
showmessage('数据库恢复完毕!!');
panel7.Visible:=false;
end;
procedure TForm_SJhf.copyFile(Sender: TObject);
begin
//kjdlf
end;
procedure TForm_SJhf.FormClose(Sender: TObject; var Action: TCloseAction);
begin
gzda_dm.OnDestroy(self);
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?