- 工程文件
- program stuResult;
- uses
- Forms,
- controls,
- login in 'login.pas' {loginform},
- MainFrm in 'MainFrm.pas' {mainform},
- resultFrm in 'resultFrm.pas' {resultform},
- dmFrm in 'dmFrm.pas' {DM: TDataModule},
- termAdd in 'termAdd.pas' {termForm},
- classAdd in 'classAdd.pas' {classForm},
- courseAdd in 'courseAdd.pas' {courseForm},
- specialFrm in 'specialFrm.pas' {specialForm},
- specialBrowseFrm in 'specialBrowseFrm.pas' {specialBrowseForm},
- specialModifyFrm in 'specialModifyFrm.pas' {specialModifyForm},
- studentFrm in 'studentFrm.pas' {studentForm},
- userfrm in 'userfrm.pas' {userForm},
- about in 'about.pas' {AboutBox},
- sysSetFrm in 'sysSetFrm.pas' {sysSetForm};
- {$R *.res}
- begin
- Application.Initialize;
- Application.CreateForm(TDM, DM);
- Application.CreateForm(Tmainform, mainform); //主窗体MDI和登录窗体fsNormal的visible属性为false
- loginform:=Tloginform.Create(Application);
- loginform.ShowModal;
- application.Run;
- end.
- 登录窗体
- procedure Tloginform.Button1Click(Sender: TObject);
- begin
- DM.ADOQuery1.Close;
- DM.ADOQuery1.SQL.Clear;
- DM.ADOQuery1.SQL.Text:='Select * From tbUser where 用户名='''+Edit1.Text+''' and 密码='''+edit2.Text+'''';
- DM.ADOQuery1.Open;
- if DM.ADOQuery1.Bof and DM.ADOQuery1.Eof then
- begin
- Application.MessageBox('用户名或密码错误','出错',0+48);
- Edit1.SetFocus;
- Edit1.SelectAll;
- end
- else
- begin
- mainform.Show;
- loginform.Hide;
- loginform.FreeOnRelease;
- end;
- end;
转载于:https://www.cnblogs.com/kylskjb/archive/2009/11/27/1612376.html