📄 addaccountunit.pas
字号:
unit addAccountUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TaddAccountForm = class(TForm)
Label1: TLabel;
edtAccount: TEdit;
Label2: TLabel;
edtPwd: TEdit;
Label3: TLabel;
Label4: TLabel;
CBPurview: TComboBox;
BtExit: TButton;
BtAddAccount: TButton;
procedure BtAddAccountClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BtExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
addAccountForm: TaddAccountForm;
implementation
uses DataMUnit;
{$R *.dfm}
procedure TaddAccountForm.BtAddAccountClick(Sender: TObject);
var sel:integer;
begin
if ( edtAccount.Text <> '' ) and ( edtPwd.Text <> '' ) and ( CBpurview.Text <> '' ) then
begin
sel:=MessageBox(0,'是否添加该帐户','人事管理系统',MB_YESNO+MB_ICONQUESTION);
if sel=IDYES then
begin
DataM.ADOLogin.Append;
DataM.ADOLogin.FieldByName('User').AsString := Trim(edtAccount.Text);
DataM.ADOLogin.FieldByName('Pwd').AsString := Trim(edtPwd.Text);
DataM.ADOLogin.FieldByName('Purview').AsString := Trim(CBPurview.Text);
DataM.ADOLogin.Post;
end;
end
else
begin
MessageBox(0,'帐户名称,帐户密码,帐户权限不能为空!','人事管理系统',MB_OK+MB_ICONQUESTION);
end;
end;
procedure TaddAccountForm.FormShow(Sender: TObject);
begin
edtAccount.Text:='';
edtPwd.Text:='';
CBpurview.Text:='';
if DataM.ADOLogin.Active = true then
DataM.ADOLogin.Close;
DataM.ADOLogin.SQL.Clear;
DataM.ADOLogin.SQL.Text:='select * from Login';
DataM.ADOLogin.Prepared;
DataM.ADOLogin.Open;
end;
procedure TaddAccountForm.BtExitClick(Sender: TObject);
begin
addAccountForm.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -