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

📄 entry.cpp

📁 是自己做的一个小的学生管理系统.希望对大家有用
💻 CPP
字号:
// Entry.cpp : implementation file
//

#include "stdafx.h"
#include "student2.h"
#include "Entry.h"
#include "Password.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CEntry dialog


CEntry::CEntry(CWnd* pParent /*=NULL*/)
: CDialog(CEntry::IDD, pParent)
{
	//{{AFX_DATA_INIT(CEntry)
	m_password = _T("");
	//}}AFX_DATA_INIT
}


void CEntry::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CEntry)
	DDX_Control(pDX, IDC_EDIT_PASSWORD, m_passwordctrl);
	DDX_Control(pDX, IDC_EDIT_STUNO, m_stunoctrl);
	DDX_Text(pDX, IDC_EDIT_PASSWORD, m_password);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CEntry message handlers

void CEntry::OnCancel() 
{
	// TODO: Add extra cleanup here
	PostMessage(WM_QUIT);
	CDialog::OnCancel();
	
}

void CEntry::OnOK() 
{
	// TODO: Add extra validation here
	
	CString strstuno,strpd; 
	m_stunoctrl.GetWindowText(strstuno);
	if(strstuno=="")
	{
		AfxMessageBox("请输入用户名!");
		return;
	}
	m_passwordctrl.GetWindowText(strpd);
	if(strpd=="")
	{
		AfxMessageBox("请输入密码!");
		return;
	}

	CString str;
	str.Format("SELECT * FROM password ");
	CDatabase db;
	CPassword pd(&db);
	pd.Open(AFX_DB_USE_DEFAULT_TYPE,str);
	
	CString value;
	pd.MoveFirst();
	while(!pd.IsEOF())
	{				
		pd.GetFieldValue("password",pd.m_password);
		value.Format("%s",pd.m_password);
		if(value==strpd)
		{
			CDialog::OnOK();
			return;
		}
		pd.MoveNext();
	}
	AfxMessageBox("密码错误,请重新输入!");
	
}

⌨️ 快捷键说明

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