⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stulogin.cpp

📁 数据库管理系统
💻 CPP
字号:
// StuLogin.cpp : implementation file
//

#include "stdafx.h"
#include "SCMIS.h"
#include "StuLogin.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CDatabase db;
/////////////////////////////////////////////////////////////////////////////
// CStuLogin dialog


CStuLogin::CStuLogin(CWnd* pParent /*=NULL*/)
	: CDialog(CStuLogin::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStuLogin)
	m_id = _T("");
	m_pswd = _T("");
	//}}AFX_DATA_INIT
	count=0;
}


void CStuLogin::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStuLogin)
	DDX_Text(pDX, IDC_EDIT1, m_id);
	DDX_Text(pDX, IDC_EDIT2, m_pswd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStuLogin, CDialog)
	//{{AFX_MSG_MAP(CStuLogin)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStuLogin message handlers

void CStuLogin::OnOK() 
{
	
    CStuLoginSet *m_recordset=new CStuLoginSet(&db);
	CString strSQL;
	UpdateData(TRUE);
	strSQL.Format("select ID,PSWD from STUDENT where ID='%s' AND PSWD='%s'",m_id,m_pswd);
	m_recordset->Open(CRecordset::forwardOnly/*AFX_DB_USE_DEFAULT_TYPE*/,strSQL);
	if(m_recordset->GetRecordCount()==0){
		if(count<3){
			MessageBox("login incorrect!");
			count++;
		}
		else{
			MessageBox("too many trials");
	
			CDialog::OnOK();
		}
	}
	else{
		
		CStuProSht dlg("学生选课系统",this,0);
        //dlg.m_id=this->m_id;
        dlg.m_id.Format("%s",m_id);
		dlg.DoModal();

		CDialog::OnOK();
	}
	

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -