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

📄 managempsddlg.cpp

📁 数据库管理系统
💻 CPP
字号:
// ManageMpsdDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SCMIS.h"
#include "ManageMpsdDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CDatabase db;
/////////////////////////////////////////////////////////////////////////////
// CManageMpsdDlg dialog


CManageMpsdDlg::CManageMpsdDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CManageMpsdDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CManageMpsdDlg)
	m_former = _T("");
	m_new = _T("");
	m_confim = _T("");
	//}}AFX_DATA_INIT
	m_id="";
}


void CManageMpsdDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CManageMpsdDlg)
	DDX_Text(pDX, IDC_EDIT1, m_former);
	DDX_Text(pDX, IDC_EDIT2, m_new);
	DDX_Text(pDX, IDC_EDIT3, m_confim);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CManageMpsdDlg message handlers

void CManageMpsdDlg::OnOK() 
{
	// TODO: Add extra validation here
	   CRecordset rs(&db);
	   CString strSQL;int count=0;
	   this->UpdateData(TRUE);
	   strSQL.Format("select * from admin where id='%s' and pswd='%s'",m_id,m_former);
	   rs.Open(CRecordset::forwardOnly,strSQL);
	   if(rs.GetRecordCount()==0)
		   AfxMessageBox("密码错误");
	   else
	   {
		   if(m_confim!=m_new)
		   {
			   AfxMessageBox("确认密码错误");
			 
		   }
		   else
		   { 
			   strSQL.Format("update admin set pswd='%s' where id='%s'",m_new,m_id);
		       db.ExecuteSQL(strSQL);
               AfxMessageBox("密码修改成功");
			   CDialog::OnOK();
		   }
	   }

		
}

⌨️ 快捷键说明

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