📄 unit21.~pas
字号:
unit Unit21;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids;
type
Tgzbiaozhun = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
DBGrid1: TDBGrid;
procedure Button4Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
gzbiaozhun: Tgzbiaozhun;
implementation
uses Unit1, Unit2, Unit3, Unit22;
{$R *.dfm}
procedure Tgzbiaozhun.Button4Click(Sender: TObject);
begin
gzbiaozhun.Close;
end;
procedure Tgzbiaozhun.Button2Click(Sender: TObject);
begin
application.CreateForm(Tgzbzxiugai,gzbzxiugai);
gzbzxiugai.ShowModal;
gzbzxiugai.Free;
end;
procedure Tgzbiaozhun.Button1Click(Sender: TObject);
begin
if edit1.Text<>'' then
begin
if edit2.Text<>'' then
begin
with dm.ADOQuery1 do
begin
sql.Clear;
sql.Add('select * from gzbiaozhun where 工资等级='''+edit1.Text+'''' );
Open;
if dm.ADOQuery1.Eof then
begin
Append;
FieldByName('工资等级').AsString:=edit1.Text;
FieldByName('等级名称').AsString:=edit2.Text;
FieldByName('底薪').AsString:=edit3.Text;
FieldByName('补贴').AsString:=edit4.Text;
FieldByName('奖金').AsString:=edit5.Text;
FieldByName('车补').AsString:=edit6.Text;
FieldByName('房补').AsString:=edit7.Text;
FieldByName('养老金').AsString:=edit8.Text;
FieldByName('医疗保险').AsString:=edit9.Text;
FieldByName('住房公积金').AsString:=edit10.Text;
post;
sql.Clear;
sql.Add('select * from gzbiaozhun ' );
Open;
application.MessageBox('添加成功!','提示',64);
edit1.SetFocus;
end
else
begin
application.MessageBox('已存在的等级名称,请重新输入等级名称!!','木鱼工作室',mb_iconhand+mb_yesno);
edit1.Text:='';
edit1.SetFocus;
sql.Clear;
sql.Add('select * from gzbiaozhun ' );
Open;
end
end
end
else
begin
application.MessageBox('请输入等级名称!!','木鱼工作室',mb_iconhand+mb_yesno);
edit1.Text:='';
edit1.SetFocus;
end
end
else
begin
application.MessageBox('请输入工资等级!!','木鱼工作室',mb_iconhand+mb_yesno);
edit2.Text:='';
edit2.SetFocus;
end;
end;
procedure Tgzbiaozhun.FormCreate(Sender: TObject);
var
i:integer;
begin
with dm.ADOQuery1 do
begin
sql.Clear;
sql.Add('select * from gzbiaozhun ');
Open;
dbgrid1.Columns[0].FieldName:='工资等级';
dbgrid1.Columns[1].FieldName:='等级名称';
dbgrid1.Columns[2].FieldName:='底薪';
dbgrid1.Columns[3].FieldName:='补贴';
dbgrid1.Columns[4].FieldName:='奖金';
dbgrid1.Columns[5].FieldName:='车补';
dbgrid1.Columns[6].FieldName:='房补';
dbgrid1.Columns[7].FieldName:='养老金';
dbgrid1.Columns[8].FieldName:='医疗保险';
dbgrid1.Columns[9].FieldName:='住房公积金';
for i:=0 to 9 do
dbgrid1.Columns[i].Width:=80;
end;
end;
procedure Tgzbiaozhun.Button3Click(Sender: TObject);
begin
if application.MessageBox('确实要删除当前数据吗?','提示',mb_iconquestion+mb_yesno)=id_yes then
begin
try
dm.ADOQuery1.Delete;
dm.ADOQuery1.Refresh;
application.MessageBox('删除成功!','提示',64);
except
application.MessageBox('系统出错!','提示',64);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -