Application.Initialize;
Application.CreateForm(TdmMain, dmMain); //数据库连接
if ConnectState then begin //如果连接正常
frmLogin := TfrmLogin.Create(nil);//登陆
if (frmLogin.ShowModal = mrOK) then begin //如果登陆正常
frmLogin.Free;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end else begin
frmLogin.Free;
Application.Terminate;
end;
end else
Application.Terminate;
我用一点问题都没有,我认为是比较好的了