delphi登入主窗体后 登入窗体怎么让其消失?
这是我的代码unitLogin;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Cont...
这是我的代码unit Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls,Main, DBTables, DB, ADODB,untCommon;
type
Tfrmlogin = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmlogin: Tfrmlogin;
implementation
{$R *.dfm}
procedure Tfrmlogin.Button1Click(Sender: TObject);
begin
showMessage('谢谢使用本程序');
frmlogin.Close;
end;
procedure Tfrmlogin.Button3Click(Sender: TObject);
begin
if edit1.text=''then
begin
showmessage('账户不能为空');
edit1.SetFocus();
exit;
end;
if edit2.text=''then
begin
showmessage('密码不能为空');
edit2.SetFocus();
exit;
end;
begin
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select * from user_master where Fusername="'+edit1.text+'"');
open;
end;
if ADOQuery1.RecordCount=0 then
begin
showmessage('用户不存在');
edit1.SetFocus();
exit;
end;
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select * from user_master where Fusername="'+edit1.text+'" and Fpassword="'+edit2.Text+'"');
open;
end;
if ADOQuery1.RecordCount=0 then
begin
showmessage('密码不正确');
edit2.SetFocus();
exit;
end
else
begin
frmMain.show;
end;
end;
end;
end. 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls,Main, DBTables, DB, ADODB,untCommon;
type
Tfrmlogin = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label4: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmlogin: Tfrmlogin;
implementation
{$R *.dfm}
procedure Tfrmlogin.Button1Click(Sender: TObject);
begin
showMessage('谢谢使用本程序');
frmlogin.Close;
end;
procedure Tfrmlogin.Button3Click(Sender: TObject);
begin
if edit1.text=''then
begin
showmessage('账户不能为空');
edit1.SetFocus();
exit;
end;
if edit2.text=''then
begin
showmessage('密码不能为空');
edit2.SetFocus();
exit;
end;
begin
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select * from user_master where Fusername="'+edit1.text+'"');
open;
end;
if ADOQuery1.RecordCount=0 then
begin
showmessage('用户不存在');
edit1.SetFocus();
exit;
end;
with ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('select * from user_master where Fusername="'+edit1.text+'" and Fpassword="'+edit2.Text+'"');
open;
end;
if ADOQuery1.RecordCount=0 then
begin
showmessage('密码不正确');
edit2.SetFocus();
exit;
end
else
begin
frmMain.show;
end;
end;
end;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询