if RadioButton2.Checked=True Then ccc:='B'
Else
begin
If RadioButton3.Checked = True Then
begin
ccc:='C';
If CheckBox1.Checked = True Then
begin
ccc:=ccc+'D';
end;
If CheckBox2.Checked = True Then
begin
ccc:=ccc+'E';
end;
If CheckBox3.Checked = True Then
begin
ccc:=ccc+'F';
end;
end;
If Length(ccc) = 1 Then
begin
if ccc='C' then
begin
ShowMessage('请选择自定义权限.');
Exit;
end;
end;
end;
end;
with table1 do
begin
open;
append;
FieldByName('权限').AsString:=ccc;
Post;
Panel1.Enabled:=True;
GroupBox3.Visible:=False;
DBGrid1.Enabled:=True;
GroupBox1.Enabled:=True;
end;
Except
ShowMessage('用户名不能重复.');
End;
end;
其余主要代码如下:
procedure TForm3.BitBtn2Click(Sender: TObject);//添加信息中的“取消”
begin
GroupBox3.Visible:=False;
GroupBox1.Enabled:=True;
DBGrid1.Enabled:=True;
Panel1.Enabled:=True;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TForm3.BitBtn4Click(Sender: TObject);//修改用户信息
begin
if table1.FieldByName('编号').AsString='contral' then
begin
table1.Edit;
DBEdit1.Enabled:=False;
DBEdit2.Enabled:=False;
GroupBox3.Visible:=True;
DBEdit3.SetFocus;
DBGrid1.Enabled:=False;
Panel1.Enabled:=False;
End
Else
begin
DBEdit1.Enabled:=True;
DBEdit2.Enabled:=True;
table1.Edit;
GroupBox3.Visible:=True;
DBEdit1.SetFocus;
Panel1.Enabled:=False;
DBGrid1.Enabled:=False;
GroupBox1.Enabled:=False;
end;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TForm3.BitBtn5Click(Sender: TObject);//删除用户信息
begin
groupbox3.Visible:=false;
with table1 do
if Active then
begin
Active:=true;
open;
delete;
end;
end;
4.4 员工信息管理模块
(2)程序代码如下:
procedure TForm13.FormCreate(Sender: TObject);
begin
query1.Open;
query2.Open;
query3.Open;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TForm13.BitBtn1Click(Sender: TObject);
begin
if edit1.Text<>''then
begin
query1.Close;
query1.sql.Clear;
query1.SQL.Add('select * from employee where 员工编号=:num');
query1.Params[0].AsString:=edit1.Text;
try
query1.Open;
//if query1.Params[0].AsInteger<>query1.FieldByName('员工编号').AsInteger then
//begin
//showmessage('没有查找到此编号的员工信息!');
//edit1.SetFocus;