?? setpassword.cpp
字號:
// SetPassWord.cpp : implementation file
//
#include "stdafx.h"
#include "Student.h"
#include "SetPassWord.h"
#include "studentdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetPassWord dialog
extern CStudentApp theApp;
CSetPassWord::CSetPassWord(CWnd* pParent /*=NULL*/)
: CDialog(CSetPassWord::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetPassWord)
m_sNewPass = _T("");
m_sVerify = _T("");
//}}AFX_DATA_INIT
}
void CSetPassWord::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetPassWord)
DDX_Text(pDX, IDC_NewPass, m_sNewPass);
DDX_Text(pDX, IDC_Verify, m_sVerify);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetPassWord, CDialog)
//{{AFX_MSG_MAP(CSetPassWord)
ON_BN_CLICKED(IDC_TRUE, OnTrue)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetPassWord message handlers
void CSetPassWord::OnTrue()
{
_variant_t RecordsAffected;
char buf[100];
UpdateData(TRUE);
sprintf(buf,"update users set password = \'%s\' where username=\'%s\'",m_sNewPass,theApp.m_sUserName );
if(!(m_sNewPass==m_sVerify))
{
MessageBox("密碼不一致!");
m_sVerify="";
UpdateData(TRUE);
return;
}
try
{
theApp.m_pConnect->Execute(buf,&RecordsAffected,adCmdText);
MessageBox("密碼修改成功!");
CDialog::OnOK();
}
catch(_com_error e)
{
AfxMessageBox(e.ErrorMessage());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -