otStuDialog.hquotinclude quotTeacherDialog.hquotCString usernumberCString usernameifdef _DEBUGdefine new DEBUG_NEWundef THIS_FILEstatic char THIS_FILE __FILE__endifCLogonDialog::CLogonDialogCWnd pParent /NULL/ : CDialogCLogonDialog::IDD pParentvoid CLogonDialog::DoDataExchangeCDataExchange pDX CDialog::DoDataExchangepDXBEGIN_MESSAGE_MAPCLogonDialog CDialog ON_BN_CLICKEDIDC_LOG OnLog ON_BN_CLICKEDIDC_LOGCANCLE OnLogcancle END_MESSAGE_MAPvoid CLogonDialog::OnLog CDatabase db db.OpenExquotDSNStudentquot CString typekeyuser GetDlgItemTextIDC_TYPEtype GetDlgItemTextIDC_USERuser GetDlgItemTextIDC_KEYkey ifkey.IsEmptyuser.IsEmptytype.IsEmpty AfxMessageBoxquot用户名或密码或类别不能为空quot return 第 14 页 共 47 页 CString strSQL CRecordset rsampdb int i iftypequot管理员quot strSQL.Formatquotselect Aname from Admini where Anums andAkeysquotuserkey rs.OpenCRecordset::snapshotstrSQL irs.GetRecordCount ifi0 AfxMessageBoxquot用户名或密码错误quot SetDlgItemTextIDC_USERquotquot SetDlgItemTextIDC_KEYquotquot return rs.GetFieldValuequotAnamequotusername usernumberuser SendMessageWM_CLOSE CAdmDialog adm adm.DoModal else iftypequot教师quot strSQL.Formatquotselect Tname from Teacher where Tnums andTkeysquotuserkey rs.OpenCRecordset::snapshotstrSQL irs.GetRecordCount ifi0 AfxMessageBoxquot用户名或密码错误quot SetDlgItemTextIDC_USERquotquot SetDlgItemTextIDC_KEYquotquot return rs.GetFieldValuequotTnamequotusername usernumberuser SendMessageWM_CLOSE CTeacherDialog tea tea.DoModal 第 15 页 共 47 页 else iftypequot学生quot strSQL.Formatquotselect Name from Student where Nums andSkeysquotuserkey rs.OpenCRecordset::snapshotstrSQL irs.GetRecordCount ifi0 AfxMessageBoxquot用户名或密码错误quot SetDlgItemTextIDC_USERquotquot SetDlgItemTextIDC_KEYquotquot return rs.GetFieldV.
上一篇:
动态加载驱动和Linux内核移植
下一篇:
倒着看世界