📄 ulogin.~pas
字号:
unit ULogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBClient,DB, ADODB,Provider,UDataMDL,actnlist;
type
TFLogin = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FLogin: TFLogin;
implementation
uses UMain,md5;
{$R *.dfm}
procedure TFLogin.Button2Click(Sender: TObject);
begin
close;
end;
procedure TFLogin.Button1Click(Sender: TObject);
var
sql:string;
i:integer;
mpwd:string;
begin
if Edit1.Text='' then
begin
Application.MessageBox('用户名不能为空','提示信息',mb_ok);
edit1.SetFocus;
exit;
end;
if Edit2.Text='' then
begin
Application.MessageBox('密码不能为空','提示信息',MB_OK);
Edit2.SetFocus;
exit;
end;
mpwd:=md5.MD5Print(md5.MD5String(edit2.Text));
sql:='select * from users where username='''+Edit1.Text+''' and password='''+mpwd+'''';
// dsp:=TDataSetProvider.Create(nil);
// dsp.DataSet:=DataMDL.ADOQuery;
// DataMDL.ADOQuery.Close;
//DataMDL.ADOQuery.SQL.Text:=sql;
// DataMDL.ADOQuery.Open;
//cds.Data:=dsp.Data;
//dsp.Free ;
// cds.Open;
// if not cds.IsEmpty then
DataMDL.ADOQuery.Close;
DataMDL.ADOQuery.SQL.Clear ;
DataMDL.ADOQuery.SQL.Add(sql);
DataMDL.ADOQuery.Open ;
if DataMDL.ADOQuery.RecordCount>0 then
begin
// ch:=inttostr(ActionList1.ActionCount);
for i:=0 to FMain.ActionList1.ActionCount-1 do
TAction(FMain.ActionList1.Actions[i]).Enabled:=true;
close;
end
else
begin
showmessage('登录失败');
exit;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -