N
nofuture
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Flogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Mask;
type
TF_login = class(TForm)
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit1: TEdit;
Combo1: TComboBox;
Label3: TLabel;
Label4: TLabel;
procedure BitBtn2Click(Sender: TObject);
procedure plogin;
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
m:boolean = false;
s:integer = 0;
F_login: TF_login;
implementation
uses Main,Fdata;
{$R *.dfm}
procedure TF_login.BitBtn2Click(Sender: TObject);
begin
if m=false then
application.Terminate
else
close;
end;
procedure TF_login.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if m = false then
application.Terminate ;
end;
procedure TF_login.BitBtn1Click(Sender: TObject);
begin
s := s+1;
if combo1.Text = ''then
application.MessageBox('请输入用户名','提示',1)
else
if edit1.Text='' then
application.MessageBox('请输入密码','提示',1)
else
plogin;
end;
procedure TF_login.plogin;
begin
with F_data.user do
begin
close;
SQL.Clear ;
SQL.Add('select * from 员工表 where name=:name and password =assword');
parameters.ParamByName('name').Value := trim(combo1.Text );
parameters.ParamByName('password').Value := trim(edit1.Text );
open;
end;
if F_data.user.recordcount > 0 then
begin
m:=true;
close;
end
else
if s<3 then
begin
Application.MessageBox('用户名或密码不正确,请重新输入','提示', 1);
combo1.Clear;
edit1.Clear;
combo1.SetFocus ;
end;
end;
end.
郁闷一天了,为什么一关闭就退出呢?
弹出"用户名或密码不正确,请重新输入"后,点击确定后程序就Terminate了!我很奇怪,程序明明没有任何问题,为什么会这样呢?难道在其他地方还有设置?
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Mask;
type
TF_login = class(TForm)
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit1: TEdit;
Combo1: TComboBox;
Label3: TLabel;
Label4: TLabel;
procedure BitBtn2Click(Sender: TObject);
procedure plogin;
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
m:boolean = false;
s:integer = 0;
F_login: TF_login;
implementation
uses Main,Fdata;
{$R *.dfm}
procedure TF_login.BitBtn2Click(Sender: TObject);
begin
if m=false then
application.Terminate
else
close;
end;
procedure TF_login.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if m = false then
application.Terminate ;
end;
procedure TF_login.BitBtn1Click(Sender: TObject);
begin
s := s+1;
if combo1.Text = ''then
application.MessageBox('请输入用户名','提示',1)
else
if edit1.Text='' then
application.MessageBox('请输入密码','提示',1)
else
plogin;
end;
procedure TF_login.plogin;
begin
with F_data.user do
begin
close;
SQL.Clear ;
SQL.Add('select * from 员工表 where name=:name and password =assword');
parameters.ParamByName('name').Value := trim(combo1.Text );
parameters.ParamByName('password').Value := trim(edit1.Text );
open;
end;
if F_data.user.recordcount > 0 then
begin
m:=true;
close;
end
else
if s<3 then
begin
Application.MessageBox('用户名或密码不正确,请重新输入','提示', 1);
combo1.Clear;
edit1.Clear;
combo1.SetFocus ;
end;
end;
end.
郁闷一天了,为什么一关闭就退出呢?
弹出"用户名或密码不正确,请重新输入"后,点击确定后程序就Terminate了!我很奇怪,程序明明没有任何问题,为什么会这样呢?难道在其他地方还有设置?