www.gusucode.com > VC++超市进销存管理系统(Access)-源码程序 > VC++超市进销存管理系统(Access)-源码程序/code/NcShop/DlgPwd.cpp
//Download by http://www.NewXing.com // DlgPwd.cpp : implementation file // #include "stdafx.h" #include "ncshop.h" #include "DlgPwd.h" #include "ADOConn.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDlgPwd dialog CDlgPwd::CDlgPwd(CWnd* pParent /*=NULL*/) : CDialog(CDlgPwd::IDD, pParent) { //{{AFX_DATA_INIT(CDlgPwd) m_str1 = _T(""); m_str2 = _T(""); m_str3 = _T(""); //}}AFX_DATA_INIT } void CDlgPwd::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgPwd) DDX_Control(pDX, IDOK, m_Btn1); DDX_Control(pDX, IDCANCEL, m_Btn2); DDX_Text(pDX, IDC_EDIT1, m_str1); DDX_Text(pDX, IDC_EDIT2, m_str2); DDX_Text(pDX, IDC_EDIT3, m_str3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDlgPwd, CDialog) //{{AFX_MSG_MAP(CDlgPwd) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDlgPwd message handlers BOOL CDlgPwd::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here GetDlgItem(IDC_STATIC1)->SetFont(&ftHeader,TRUE); m_Btn1.SetXIcon(IDI_ICONBUTTON); m_Btn2.SetXIcon(IDI_ICONBUTTON); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDlgPwd::OnOK() { // TODO: Add extra validation here UpdateData(TRUE); CString strSql; CADOConn adoMain; strSql="select * from 管理员基本信息表 where 编号='"; strSql=strSql+strNo+"' and 密码='"; strSql=strSql+m_str1+"'"; adoMain.Open(strSql); if(!adoMain.adoEOF()) { if(m_str2!=m_str3) { MessageBox("新密码与重新输入的不照!","提示",MB_OK+MB_ICONWARNING); return; } strSql="update 管理员基本信息表 set 密码='"; strSql=strSql+m_str2+"' where 编号='"; strSql=strSql+strNo+"'"; adoMain.ExecuteSQL(strSql); CDialog::OnOK(); } else MessageBox("密码错误!","提示",MB_OK+MB_ICONWARNING); adoMain.ExitConnect(); }