?? login.~pas
字號:
unit Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TLoginForm = class(TForm)
Image1: TImage;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
ComboBox1: TComboBox;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
LoginForm: TLoginForm;
UseId,Types,Passwd:String;
BackPasswd,BackTypes:String;
implementation
uses Data, Main;
{$R *.dfm}
procedure TLoginForm.Button1Click(Sender: TObject);
begin
UseId := Edit1.Text;
Passwd := Edit2.Text;
Types := ComboBox1.Text;
if UseId='' then //登錄證號為空
begin
Application.MessageBox('請輸入登錄證號','登錄錯誤信息',MB_OK+MB_ICONEXCLAMATION);
end
else
begin
with Data.DataModule.LoginSelect do
if Types='管理員' then
begin
Close;
SQL.Clear;
SQL.Add('select 工作編號,密碼,管理員類型 from 管理員');
SQL.Add('where 工作編號 = ''' + UseId + ''' and 密碼 = ''' + Passwd +'''');
Open;
BackPasswd := FieldByName('密碼').AsString;
BackTypes := FieldByName('管理員類型').AsString;
if BackTypes='' then //未在數據庫中找到對應記錄
begin
Application.MessageBox('無效的登錄證號或密碼!請確認無誤后再輸入','登錄錯誤信息',MB_OK+MB_ICONEXCLAMATION);
end
else
begin
MainForm.Show;
LoginForm.Hide;
end
end
else if Types='借閱者' then
begin
Close;
SQL.Clear;
SQL.Add('select 讀者證號,密碼,讀者類型 from 讀者');
SQL.Add('where 讀者證號 = ''' + UseId + ''' and 密碼 = ''' + Passwd +'''');
Open;
BackPasswd := FieldByName('密碼').AsString;
BackTypes := FieldByName('讀者類型').AsString;
if BackTypes='' then //未在數據庫中找到對應記錄
begin
Application.MessageBox('無效的登錄證號或密碼!請確認無誤后再輸入','登錄錯誤信息',MB_OK+MB_ICONEXCLAMATION);
end
else
begin
BackTypes := '110';
MainForm.Show;
LoginForm.Hide;
end
end
end;
LoginForm.Edit1.Clear;
LoginForm.Edit2.Clear;
end;
procedure TLoginForm.Button2Click(Sender: TObject);
begin
LoginForm.Close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -