?? flogin.pas
字號:
unit flogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, RzButton, Mask, RzEdit, RzLabel;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
RzLabel1: TRzLabel;
RzLabel2: TRzLabel;
RzLabel3: TRzLabel;
RzEdit1: TRzEdit;
RzEdit2: TRzEdit;
RzBitBtn1: TRzBitBtn;
RzBitBtn2: TRzBitBtn;
ADOTable1: TADOTable;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
procedure RzBitBtn1Click(Sender: TObject);
procedure RzBitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
fmain;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.Show;
end;
procedure TForm1.RzBitBtn1Click(Sender: TObject);
var a1,a2,b1,b2:string; //定義變量a1,a2,b1,b2 為字符串變量
begin
with ADOtable1 do
begin
open;
ADOconnection1.Connected:=true; //連接數據庫
a1:=fieldbyname('guest').Value ; //將客戶的用戶名賦給a1
a2:=fieldbyname('password_g').Value ; //將客戶的密碼賦給a2
b1:=fieldbyname('admin').Value ; //將管理員的用戶名賦給b1
b2:=fieldbyname('password_a').Value ; //將管理員的密碼賦給b2
if ( a1=trim(Rzedit1.Text)) and (a2=trim(Rzedit2.Text) ) then
begin
form2.Show ; //切換到主界面
end
else if (b1=trim(Rzedit1.Text)) and (b2=trim(Rzedit2.Text )) then
begin
form2.Show;
end
//輸入的用戶名和密碼不正確,提示出錯,同時清空輸入文本框!
else
begin
messagedlg('輸入出錯,請重新輸入!',mterror,[mbok],0);
Rzedit1.Text :=''; //清空文本框,以便重新輸入!
Rzedit2.Text :='';
Rzedit1.SetFocus ; //光標重新定位到"用戶名"文本框
end;
end;
Rzedit1.Text :='';
Rzedit2.Text :='';
end;
procedure TForm1.RzBitBtn2Click(Sender: TObject);
begin
close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -