📄 unit12.pas
字号:
unit Unit12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, Grids, DBGrids, StdCtrls, Mask;
type
Tshanchuzhiwu = class(TForm)
Label1: TLabel;
Label6: TLabel;
Label5: TLabel;
Label3: TLabel;
Label2: TLabel;
Label4: TLabel;
Label7: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
RadioButton1: TRadioButton;
DBGrid1: TDBGrid;
RadioButton2: TRadioButton;
procedure FormCreate(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure DBGrid1TitleClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;
var
shanchuzhiwu: Tshanchuzhiwu;
implementation
uses Unit1, Unit10, Unit11, Unit2, Unit3, Unit4, Unit5, Unit6, Unit7,
Unit8, Unit9;
{$R *.dfm}
procedure Tshanchuzhiwu.FormCreate(Sender: TObject);
begin
ComboBox1.Items.Add('A1级');
ComboBox1.Items.Add('A2级');
ComboBox1.Items.Add('A3级');
ComboBox1.Items.Add('B1级');
ComboBox1.Items.Add('B2级');
ComboBox1.Items.Add('B3级');
ComboBox1.Items.Add('C1级');
ComboBox1.Items.Add('C2级');
ComboBox1.Items.Add('C3级');
ComboBox2.Items.Add('20000');
ComboBox2.Items.Add('15000');
ComboBox2.Items.Add('10000');
ComboBox2.Items.Add('9000');
ComboBox2.Items.Add('5000');
ComboBox2.Items.Add('4000');
ComboBox2.Items.Add('3000');
ComboBox2.Items.Add('1000');
ComboBox3.Items.Add('800');
ComboBox3.Items.Add('1000');
ComboBox3.Items.Add('1200');
ComboBox3.Items.Add('2000');
ComboBox3.Items.Add('3000');
ComboBox3.Items.Add('4000');
dm.ADOTable2.Close;
dm.ADOTable2.TableName:='zhiwuxinxi';
dm.ADOTable2.Active:=true;
dbgrid1.Columns[0].FieldName:='职务代码';
dbgrid1.Columns[1].FieldName:='职务名称';
dbgrid1.Columns[2].FieldName:='工资等级id';
dbgrid1.Columns[3].FieldName:='工资上限';
dbgrid1.Columns[4].FieldName:='工资下限';
dbgrid1.Columns[5].FieldName:='简介';
dbedit1.DataField:='职务代码';
dbedit2.DataField:='职务名称';
dbedit3.DataField:='简介';
ComboBox1.Text:=dm.ADOTable2.fieldbyname('工资等级id').AsString;
ComboBox2.Text:=dm.ADOTable2.fieldbyname('工资上限').AsString;
ComboBox3.Text:=dm.ADOTable2.fieldbyname('工资下限').AsString;
end;
procedure Tshanchuzhiwu.RadioButton1Click(Sender: TObject);
begin
if radiobutton1.Checked=true then
begin
Button1.Enabled:=true;
Button2.Enabled:=false;
dbedit1.Enabled:=true;
dbedit2.Enabled:=true;
dbedit3.Enabled:=true;
ComboBox1.Enabled:=true;
ComboBox2.Enabled:=true;
ComboBox3.Enabled:=true;
end;
end;
procedure Tshanchuzhiwu.Button3Click(Sender: TObject);
begin
shanchuzhiwu.Close;
end;
procedure Tshanchuzhiwu.Button2Click(Sender: TObject);
begin
if application.MessageBox('确实要删除当前数据吗?','提示',mb_iconquestion+mb_yesno)=id_yes then
begin
try
dm.ADOTable2.Delete;
dm.ADOTable2.Refresh;
application.MessageBox('删除成功!','提示',64);
except
application.MessageBox('系统出错!','提示',64);
end;
end;
end;
procedure Tshanchuzhiwu.Button1Click(Sender: TObject);
begin
with dm.ADOTable2 do
begin
edit;
FieldByName('职务代码').AsString:=dbedit1.Text;
FieldByName('职务名称').AsString:=dbedit2.Text;
FieldByName('工资等级id').AsString:=ComboBox1.Text;
FieldByName('工资上限').AsString:=ComboBox2.Text;
FieldByName('工资下限').AsString:=ComboBox3.Text;
FieldByName('简介').AsString:=dbedit3.Text;
post;
end;
application.MessageBox('修改成功!','提示',64);
end;
procedure Tshanchuzhiwu.RadioButton2Click(Sender: TObject);
begin
if radiobutton2.Checked=true then
begin
Button1.Enabled:=false;
Button2.Enabled:=true;
dbedit1.Enabled:=false;
dbedit2.Enabled:=false;
dbedit3.Enabled:=false;
ComboBox1.Enabled:=false;
ComboBox2.Enabled:=false;
ComboBox3.Enabled:=false;
end;
end;
procedure Tshanchuzhiwu.DBGrid1CellClick(Column: TColumn);
begin
ComboBox1.Text:=dm.ADOTable2.fieldbyname('工资等级id').AsString;
ComboBox2.Text:=dm.ADOTable2.fieldbyname('工资上限').AsString;
ComboBox3.Text:=dm.ADOTable2.fieldbyname('工资下限').AsString;
end;
procedure Tshanchuzhiwu.DBGrid1TitleClick(Column: TColumn);
begin
ComboBox1.Text:=dm.ADOTable2.fieldbyname('工资等级id').AsString;
ComboBox2.Text:=dm.ADOTable2.fieldbyname('工资上限').AsString;
ComboBox3.Text:=dm.ADOTable2.fieldbyname('工资下限').AsString;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -