📄 pawmod.cpp
字号:
// Pawmod.cpp : implementation file
//
#include "stdafx.h"
#include "TSG.h"
#include "Pawmod.h"
#include "Login.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Pawmod dialog
Pawmod::Pawmod(CWnd* pParent /*=NULL*/)
: CDialog(Pawmod::IDD, pParent)
{
//{{AFX_DATA_INIT(Pawmod)
m_formerps = _T("");
m_newps = _T("");
m_confirmps = _T("");
//}}AFX_DATA_INIT
}
void Pawmod::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Pawmod)
DDX_Text(pDX, IDC_EDIT1, m_formerps);
DDX_Text(pDX, IDC_EDIT2, m_newps);
DDX_Text(pDX, IDC_EDIT3, m_confirmps);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Pawmod, CDialog)
//{{AFX_MSG_MAP(Pawmod)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Pawmod message handlers
void Pawmod::OnOK()
{
UpdateData(TRUE);
CDBVariant varValue;
Login m_recordset(&m_database);
CString strSQL;
strSQL.Format("select * from USER_PSWD where 用户名='%s'",user);
m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
m_recordset.GetFieldValue(1,varValue);
if(m_formerps.Compare(varValue.m_pstring->GetBuffer(1))!=0){
MessageBox("旧密码错误!!!");
m_formerps.Empty();
m_newps.Empty();
m_confirmps.Empty();
UpdateData(FALSE);
}
else{
if(m_newps.Compare(m_confirmps)!=0){
MessageBox("新密码不一致!!!");
m_formerps.Empty();
m_newps.Empty();
m_confirmps.Empty();
UpdateData(FALSE);
}
else{
strSQL.Format("delete from USER_PSWD where 用户名='%s'",user);
m_database.ExecuteSQL(strSQL);
strSQL.Format("insert into USER_PSWD values(\'%s\',\'%s\')",user,m_newps);
m_database.ExecuteSQL(strSQL);
MessageBox("密码修改成功!!!");
CDialog::OnOK();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -