📄 jwcdlg.cpp
字号:
// JWCDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SCMIS.h"
#include "JWCDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CDatabase db;
#include"JWCMainDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CJWCDlg dialog
CJWCDlg::CJWCDlg(CWnd* pParent /*=NULL*/)
: CDialog(CJWCDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CJWCDlg)
m_name = _T("");
m_pswd = _T("");
//}}AFX_DATA_INIT
count=0;
}
void CJWCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CJWCDlg)
DDX_Text(pDX, IDC_EDIT_NAME, m_name);
DDX_Text(pDX, IDC_EDIT_PSWD, m_pswd);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CJWCDlg, CDialog)
//{{AFX_MSG_MAP(CJWCDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CJWCDlg message handlers
void CJWCDlg::OnOK()
{
// TODO: Add extra validation here
CRecordset m_recordset(&db);
CString strSQL;
UpdateData(TRUE);
strSQL.Format("select id from ADMIN where NAME='%s' AND PSWD='%s'",m_name,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{
this->ShowWindow(SW_HIDE);
CDBVariant varValue;
CJWCMainDlg dlg;
int temp=0;
m_recordset.GetFieldValue(temp,varValue);
dlg.m_id=varValue.m_pstring->GetBuffer(1);
dlg.DoModal();
CDialog::OnOK();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -