用户登录制作

 

unit ULogin;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;

type
  TFLogin = class(TForm)
    lbl1: TLabel;
    lbl2: TLabel;
    edtAdmps: TEdit;
    lbl3: TLabel;
    lbl4: TLabel;
    edtAdmid: TEdit;
    btn1: TButton;
    btn2: TButton;
    procedure FormShow(Sender: TObject);
    procedure btn1Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
    procedure lbl3Click(Sender: TObject);
    procedure lbl4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FLogin: TFLogin;

implementation

{$R *.dfm}

uses FDataPool, UDataApi, UDeleteAll, UJingYanApi, Unit10, Unit11, Unit7,
  UPaiXuApi, URegister, UUpdateSign, 待做的教程, 房东信息表,
  工资表, 公司利润表, 经验总结, 客服反馈记录,
  日常管理助手, 日常开支表, 投资理财, 需解决的问题,
  需学习的知识点, 需要做的事, 员工信息表;

//procedure TFLogin.btn1Click(Sender: TObject);   //确认按钮
//begin
// with frmDataPool.qry用户账号表 do
// begin
//   Close;
//   SQL.Text:='select * from 用户账号表 where admid = ' + QuotedStr(edtAdmid.Text) + ' AND admps = ' + QuotedStr(edtAdmps.Text);
//   Open;
// end;
// if frmDataPool.qry用户账号表.IsEmpty then  //如果账号密码查不到,说明账号不存在
// begin
//   ShowMessage('账号不存在');
//   Exit;
// end;
//  Self.Close;
//end;
//
//procedure TFLogin.btn2Click(Sender: TObject);
//begin
//if MessageDlg('确定退出吗,退出后程序将关闭', mtConfirmation , [mbYes,mbNo],0)=mrYes then
//begin
//FLogin.ModalResult:= mrCancel; //对话框mrcancel返回
//form3.Close;
//end
//else
//FLogin.ModalResult:=0;
//end;



procedure TFLogin.btn1Click(Sender: TObject);
begin
with frmDataPool.qry用户账号表 do
begin
  Close;
  SQL.Text:='select * from 用户账号表 where admid = :admid ';
  Parameters.ParamByName('admid').Value:=edtAdmid.Text;    //为admin参数赋值;
  Open;
end;
  if frmDataPool.qry用户账号表['admps']=null then  //如果账号查找不到,说明账号错
  begin
    ShowMessage('账号不存在');
    Exit;
  end;
  if frmDataPool.qry用户账号表['admps'] <> edtadmps.Text then
  begin
    ShowMessage('密码错');
    exit;
  end;
  FLogin.ModalResult:=mrOk;//对话框mrok返回

end;


procedure TFLogin.btn2Click(Sender: TObject);
begin
 if MessageDlg('确定要退出?',mtConfirmation,[mbYes,mbNo],0)=mryes then
 begin
 FLogin.ModalResult:=mrCancel ;
 Form3.Close;
 end
else
 FLogin.ModalResult:=0;
end;



procedure TFLogin.FormShow(Sender: TObject);
begin
edtAdmid.Clear;
edtAdmps.Clear;
end;

procedure TFLogin.lbl3Click(Sender: TObject);
begin
FRegister.ShowModal;
end;

procedure TFLogin.lbl4Click(Sender: TObject);
begin
FUpdateSign.ShowModal;
end;

end.

  

posted @ 2017-05-23 17:55  delphi学习交流吧  阅读(414)  评论(0编辑  收藏  举报