login.pas

来自「一个餐饮行业的销售管理类的源码」· PAS 代码 · 共 51 行

PAS
51
字号
unit login;

interface

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

type
  TLoginForm = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    pwd: TEdit;
    OKBtn: TButton;
    CancelBtn: TButton;
    DataSource1: TDataSource;
    UserTable: TTable;
    Name: TDBComboBox;
  private
    { Private declarations }
  public
    { Public declarations }
    function canPass:boolean;
  end;

var
  LoginForm: TLoginForm;

implementation

{$R *.dfm}
function TLoginForm.canPass: boolean;
var
    V: Variant;
    A: String;
begin
    Result := False;
    V := UserTable.Lookup('Name',
        Name.Text,
        'Password');
    if not (VarType(V) in [varNull]) then begin
        A := V;
        if  A = Pwd.Text then begin
            Result := True;
            Exit;
        end;
    end;
end;

end.

⌨️ 快捷键说明

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