📄 addlbzy_u.pas
字号:
unit ADDLBZY_U;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, DB, ADODB;
type
TADDLBZY = class(TForm)
Panel1: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
Label7: TLabel;
Panel2: TPanel;
Panel3: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
message WM_GETMINMAXINFO;
public
{ Public declarations }
end;
var
ADDLBZY: TADDLBZY;
implementation
uses DB_U;
{$R *.dfm}
procedure TADDLBZY.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
with Message.MinMaxInfo^ do
begin
ptMinTrackSize := Point(445, 209);
ptMaxTrackSize := Point(445, 209);
end;
end;
procedure TADDLBZY.SpeedButton1Click(Sender: TObject);
begin
with customerdata.ADOQuery3 do begin
edit1.text:=Trim(edit1.text);
edit2.text:=Trim(edit2.text);
close;
SQL.clear;
SQL.ADD('select * from LBZY where 职员编号='''+edit1.Text+'''');
open;
if RecordCount<>0 then
Application.MessageBox('编号重复!请再次录入!','注意',MB_Iconexclamation+MB_oK)
else begin
try
close;
SQL.clear;
SQL.ADD('Insert into LBZY(职员编号,职员姓名,电话,职称,简介)');
SQL.ADD('Values(:BH,:NAME,:Tel,:ZC,:JJ)');
Parameters.ParamByName('BH').Value:=edit1.text;
Parameters.ParamByName('NAME').Value:=edit2.text;
Parameters.ParamByName('Tel').Value:=edit3.text;
Parameters.ParamByName('ZC').Value:=edit4.text;
Parameters.ParamByName('JJ').Value:=Edit5.text;
ExecSQL;
// close;
except
on Exception do
Application.MessageBox('操作失败!请退出后再进入!','注意',MB_Iconexclamation+MB_oK);
end;
customerdata.ADOQuery2.close;
customerdata.ADOQuery2.SQL.Clear;
customerdata.ADOQuery2.SQL.Add('Select * from LBZY Order By 职员编号');
customerdata.ADOQuery2.open;
customerdata.ADOQuery2.Locate('职员编号',edit1.Text, [loCaseInsensitive,loPartialKey]);
if Label7.Caption='清 空' then begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
end;
end;//else begin
end;
end;
procedure TADDLBZY.SpeedButton3Click(Sender: TObject);
begin
if Label7.Caption='清 空' then
Label7.Caption:='保 留'
else
Label7.Caption:='清 空';
end;
procedure TADDLBZY.SpeedButton2Click(Sender: TObject);
begin
Close;
end;
procedure TADDLBZY.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=$0D then
if edit2.CanFocus then
edit2.SetFocus;
end;
procedure TADDLBZY.Edit2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=$0D then
if edit3.CanFocus then
edit3.SetFocus;
end;
procedure TADDLBZY.Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=$0D then
if edit4.CanFocus then
edit4.SetFocus;
end;
procedure TADDLBZY.Edit4KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=$0D then
if edit5.CanFocus then
edit5.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -