?? unpwd.pas
字號:
unit UnPwd;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons;
type
Tlogin = class(TForm)
Label1: TLabel;
edtusername: TEdit;
edtpassword: TEdit;
Label2: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
// procedure SpeedButton2Click(Sender: TObject);
private
{ Private declarations }
public
function init:boolean;
{ Public declarations }
end;
var
login: Tlogin;
implementation
uses UnDB, UnStudent;
{$R *.dfm}
function Tlogin.init; //初始化
begin
init:=false;
if Application.FindComponent('login')=nil then
Application.CreateForm(Tlogin,login);
init:=true;
end;
procedure Tlogin.SpeedButton1Click(Sender: TObject);
var
{用戶名,密碼}
strUserName,strPassWord:string;
begin
strUserName:=trim(edtusername.Text);
strPassWord:=trim(edtpassword.Text);
// 用戶輸入控制
if (length(strusername)=0) or (length(strpassword)=0) then
begin
//Showmessage('用戶名或密碼長度不能為空!');
edtusername.SetFocus;
exit;
end;
with DataModule1 do
begin
//打開數據庫連接
if not ADOCN.Connected then
ADOCN.Open;
//設置SQL查詢
with ADOQY do
begin
close;
SQL.clear;
SQL.add('select * from user_Info where user_PWD=:username and user_Des=:password');
parameters[0].value:=strusername;
parameters[1].value:=strpassword;
open;
//驗證用戶和密碼
if recordcount<=0 then
begin
//showmessage('用戶名或密碼錯誤!');
EdtUserName.SetFocus;
Exit;
end
else
begin
//調用主界界面
if fm_ClassStudent.init then
fm_ClassStudent.Show;
login.Hide;
Exit;
end;
end;
end;
end;
procedure Tlogin.SpeedButton2Click(Sender: TObject);
begin
Application.Terminate;//結束程序,回收所有資源
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -