⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userreg.~pas

📁 毕业论文源码 毕业论文源码 毕业论文源码
💻 ~PAS
字号:
unit UserReg;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, StdCtrls;

type
  TUserRegForm = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    ComboBox1: TComboBox;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    UserTable: TTable;
    DataSource1: TDataSource;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  UserRegForm: TUserRegForm;

implementation

{$R *.dfm}

procedure TUserRegForm.Button1Click(Sender: TObject);
var
    //存放用户权限
    P : Integer;
begin
    //判断输入是否合法
    if edit1.Text = '' then
        Exit;
    if edit2.text = '' then
        Exit;
    if ComboBox1.text = '' then
        Exit;
    //增加新记录
    UserTable.Append;
    UserTable.FieldValues['Name'] := edit1.Text;
    UserTable.FieldValues['Password'] := edit2.Text;
    if ComboBox1.Text = '管理员' then
    begin
        P := 1;
    end;
    if ComboBox1.Text = '员工' then
    begin
        P := 2;
    end;
    if ComboBox1.Text = '访客' then
    begin
        P := 3;
    end;
    UserTable.FieldValues['Power'] := P;
    //提交操作
    UserTable.Post;
    close;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -