📄 unit11.pas
字号:
unit Unit11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables, ExtCtrls;
type
TForm_vist_in = class(TForm)
Edit2: TEdit;
Label1: TLabel;
ComboBox1: TComboBox;
Label3: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Memo1: TMemo;
GroupBox1: TGroupBox;
Edit1: TEdit;
Label2: TLabel;
Label7: TLabel;
Edit5: TEdit;
Button1: TButton;
Label8: TLabel;
Button2: TButton;
Query1: TQuery;
ComboBox3: TComboBox;
Label9: TLabel;
Timer1: TTimer;
ComboBox2: TEdit;
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_vist_in: TForm_vist_in;
implementation
uses Unit9, Unit1;
{$R *.dfm}
procedure TForm_vist_in.Button2Click(Sender: TObject);
begin
if (edit1.Text<>'') and (edit5.Text<>'') and (edit2.Text<>'') then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('insert into vist_log (visitor_name,host_name,host_room,relation,time_in,time_out,watch,certificate,remark) values(:visitor_name,:host_name,:host_room,:relation,:time_in,:time_out,:watch,:certificate,:remark)');
query1.ParamByName('visitor_name').AsString:=Edit2.Text;
query1.ParamByName('host_name').AsString:=Edit1.Text;
query1.ParamByName('host_room').AsString:=Edit5.Text;
query1.ParamByName('relation').AsString:=ComboBox1.Text;
query1.ParamByName('time_in').AsString:=Edit3.Text;
query1.ParamByName('time_out').AsString:=Edit4.Text;
query1.ParamByName('watch').AsString:=ComboBox2.Text;
query1.ParamByName('certificate').AsString:=ComboBox3.Text;
query1.ParamByName('remark').AsString:=Memo1.Text;
query1.ExecSQL;
showmessage('已记入数据库,访问完请急时下楼登记!');
Form_vist_in.Close;
end
else
begin
showmessage('请完整填写信息!');
end;
end;
procedure TForm_vist_in.Timer1Timer(Sender: TObject);
begin
Edit3.Text:=datetostr(date())+' '+timetostr(time());
end;
procedure TForm_vist_in.FormCreate(Sender: TObject);
begin
ComboBox2.Text:=form_main.StatusBar1.Panels[1].Text;
end;
procedure TForm_vist_in.Button1Click(Sender: TObject);
begin
if Form_vist_in.Edit1.Text<>'' then
begin
application.CreateForm(TForm_info_q1,Form_info_q1);
Form_info_q1.Edit5.Text:=Form_vist_in.Edit1.Text;
Form_info_q1.ShowModal;
Form_info_q1.Button1.Click;
Form_vist_in.Button2.Enabled:=true;
Form_vist_in.Button2.Default:=true;
end
else
begin
showmessage('请填写要查找的姓名!');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -