📄 u_whcd.pas
字号:
unit U_whcd;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, U_gzxx, DB, Grids, DBGrids, StdCtrls, ExtCtrls, ComCtrls,
Buttons, ToolWin;
type
Tfrm_whcd = class(Tfrm_gzxx)
procedure SpeedButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
m:integer;
end;
var
frm_whcd: Tfrm_whcd;
const
m=0;
implementation
uses U_data;
{$R *.dfm}
procedure Tfrm_whcd.SpeedButton1Click(Sender: TObject);
begin
edit1.Clear;
edit1.ReadOnly:=false;
speedbutton4.Enabled:=true;
speedbutton5.Enabled:=true;
end;
procedure Tfrm_whcd.FormShow(Sender: TObject);
begin
with data1.ADOQYwhcd do
begin
close;
sql.Clear;
sql.Add('select * from 文化程度表');
open;
end;
data1.ADOQYwhcd.Active:=true;
if data1.ADOQYwhcd.FieldByName('文化程度').Value=null then
application.MessageBox('数据库中没有数据,请添加数据!','提示',64)
end;
procedure Tfrm_whcd.DBGrid1CellClick(Column: TColumn);
begin
If DBGrid1.DataSource.DataSet<> Nil then
if DBGrid1.DataSource.DataSet.RecordCount>0 then
edit1.Text:=data1.ADOQYwhcd.FieldByName('文化程度').Value
end;
procedure Tfrm_whcd.SpeedButton4Click(Sender: TObject);
begin
if trim(edit1.Text)<>'' then
try
with data1.ADOQYwhcd do
begin
close;
sql.Clear;
sql.Add('insert 文化程度表 values (:a)');
parameters.ParamByName('a').Value:=trim(edit1.Text);
execsql;
end;
self.OnShow(sender);
application.MessageBox('添加成功','提示',64);
edit1.Clear;
except
application.MessageBox('系统出错','警告',64);
close;
end
else
application.MessageBox('请输入文化程度','提示',64);
end;
procedure Tfrm_whcd.SpeedButton2Click(Sender: TObject);
begin
if trim(edit1.Text)<>'' then
begin
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select * from 文化程度表 where 文化程度=:a');
parameters.ParamByName('a').Value:=trim(edit1.Text);
open;
end;
if data1.ADOpublic.RecordCount>0 then
begin
application.MessageBox('信息不能重复','提示',64);
edit1.Clear;
edit1.SetFocus;
end
else
begin
with data1.ADOQYwhcd do
begin
edit;
fieldbyname('文化程度').Value:=trim(edit1.Text);
post;
end;
application.MessageBox('修改成功','提示',64);
edit1.Clear;
end;
end;
end;
procedure Tfrm_whcd.SpeedButton3Click(Sender: TObject);
begin
with data1.ADOQYygxx do
begin
close;
sql.Clear;
sql.Add('select whcd from 人事表 where whcd = :a');
parameters.ParamByName('a').Value:=trim(edit1.Text);
open;
end;
if data1.ADOQYygxx.RecordCount>0 then
application.MessageBox('此信息已经使用,不能删除!','警告',64)
else
if messagebox(self.Handle,'真的要删除吗?','提示',mb_yesno+mb_iconquestion)=idyes then
begin
data1.ADOQYwhcd.Delete;
edit1.Clear;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -