📄 formwaitfortmpfileunit.pas
字号:
unit FormWaitForTmpFileUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ADODB, DB;
type
TFormWaitForTmpFile = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
ExecName: string;
autoID: Integer;
end;
var
FormWaitForTmpFile: TFormWaitForTmpFile;
implementation
uses FormMainUnit;
{$R *.dfm}
procedure TFormWaitForTmpFile.Button2Click(Sender: TObject);
var
tmpQuery : TADOQuery;
fileSize : string;
fStm : TFileStream;
begin
with FormMain do
begin
fStm := TFileStream.Create(execName, fmOpenRead);
fileSize := InttoStr(fStm.Size);
fStm.Free;
tmpQuery := TADOQuery.Create(nil);
tmpQuery.Connection := ADOConnection1;
with tmpQuery do
begin
Close;
Sql.Clear;
SQL.Add('update infoFile set fileBin=:fileBin,fileSize=:fileSize where autoID=:autoID');
tmpQuery.Parameters.ParamByName('fileBin').LoadFromFile(execName, ftBlob);
tmpQuery.Parameters.ParamByName('fileSize').DataType := ftstring;
tmpQuery.Parameters.ParamByName('autoID').DataType := ftInteger;
tmpQuery.Parameters.ParamByName('fileSize').Value := fileSize;
tmpQuery.Parameters.ParamByName('autoID').value := autoID;
try
ExecSQL;
application.MessageBox('更新完毕!', '提示信息', 48);
except
on e: exception do
begin
application.MessageBox(pchar('更新文件失败!' + #13 + #13 +
e.message), '错误信息', 16);
Exit;
end;
end;
tmpQuery.Free;
end;
DisplayFileList(FormMain.InfoID);
FormMain.CountTotalCpt.Caption := format('总数:%d',
[FormMain.fileList.items.count]);
end;
self.close;
end;
procedure TFormWaitForTmpFile.Button1Click(Sender: TObject);
begin
self.close;
end;
procedure TFormWaitForTmpFile.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DeleteFile(ExecName);
FormMain.WindowState := wsNormal;
FormMain.Enabled :=TRUE;
end;
procedure TFormWaitForTmpFile.FormCreate(Sender: TObject);
begin
// FormWaitForTmpFile.WindowState := wsMinimized;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -