?? unit7.pas
字號:
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, Buttons;
type
TF_dialog = class(TForm)
Label1: TLabel;
username: TEdit;
Label2: TLabel;
password: TEdit;
ADOQuery1: TADOQuery;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
F_dialog: TF_dialog;
times:integer;
implementation
uses unit1,unit9;
{$R *.dfm}
procedure TF_dialog.FormCreate(Sender: TObject);
begin
username.Text:='';
password.Text:='';
times:=1;
end;
procedure TF_dialog.BitBtn2Click(Sender: TObject);
begin
ADOquery1.Close;
ADOquery1.SQL.Clear;
ADOquery1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=mydb';
ADOquery1.SQL.Add('select LoginPass from login where loginname='+''''+trim(username.Text)+'''');
ADOquery1.Open;
if ADOquery1.Fields[0].value<>null then
begin
if ADOquery1.Fields[0].value=trim(password.Text) then
begin
Application.CreateForm(TForm1, Form1);
ADOquery1.close;
ADOquery1.ConnectionString:='';
F_dialog.Hide;
Form1.ShowModal;
end
else
if MessageDlg('密碼輸入錯誤。是否退出?',mtConfirmation,[mbYes,mbNo],0)
= mrYes then Close
else if times<3 then
begin
times:=times+1;
password.SetFocus;
end
else
begin
MessageDlg('對不起,密碼輸入嚴重錯誤!請退出。',mtInformation,[mbOk], 0);
application.Terminate ;
end
end
else
begin
Application.MessageBox('請確認用戶名是否正確!','用戶名錯誤!',mb_ok);
end;
end;
procedure TF_dialog.BitBtn1Click(Sender: TObject);
begin
username.Text:='';
password.Text:='';
username.SetFocus;
end;
procedure TF_dialog.Button1Click(Sender: TObject);
begin
APPLICATION.CreateForm(TForm9,form9);
Form9.ShowModal;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -