?? entry.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 + -