?? 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.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -