我写了一个简单的Delphi登陆代码,登陆进去过后,主窗体出来了,登陆窗体没有消失,是怎么回事,请高手看看!
这是登陆窗体代码:procedureTForm1.Button1Click(Sender:TObject);beginADOQuery1.SQL.Add('select*...
这是登陆窗体代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.SQL.Add('select * from yhbiao where yh_name = ''' + Edit1.Text + ''' and yh_password = ''' + Edit2.Text + ''' and yh_id = 0');
ADOQuery1.Open;
if ADOQuery1.Eof then
begin
ADOQuery1.SQL.Clear;
ADOQuery1.Close;
Showmessage('你输入的密码或帐号不正确');
exit;
end;
ADOQuery1.SQL.Clear;
ADOQuery1.Close;
Form1.Close;
Form2.Show;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.
这是主窗体里面的代码:
procedure TForm2.FormCreate(Sender: TObject);
begin
if Form1 = nil then
begin
Form1 := TForm1.Create(self);
end;
Form1.ShowModal;
end;
end.
请高手指点一下!!! 展开
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.SQL.Add('select * from yhbiao where yh_name = ''' + Edit1.Text + ''' and yh_password = ''' + Edit2.Text + ''' and yh_id = 0');
ADOQuery1.Open;
if ADOQuery1.Eof then
begin
ADOQuery1.SQL.Clear;
ADOQuery1.Close;
Showmessage('你输入的密码或帐号不正确');
exit;
end;
ADOQuery1.SQL.Clear;
ADOQuery1.Close;
Form1.Close;
Form2.Show;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.
这是主窗体里面的代码:
procedure TForm2.FormCreate(Sender: TObject);
begin
if Form1 = nil then
begin
Form1 := TForm1.Create(self);
end;
Form1.ShowModal;
end;
end.
请高手指点一下!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询