📄 usermodidlg.cpp
字号:
// UserModiDlg.cpp : implementation file
//
#include "stdafx.h"
#include "BookLib.h"
#include "UserModiDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserModiDlg dialog
CUserModiDlg::CUserModiDlg(CWnd* pParent /*=NULL*/)
: CDialog(CUserModiDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserModiDlg)
m_user = _T("");
m_pwd = _T("");
m_type = _T("");
//}}AFX_DATA_INIT
}
void CUserModiDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserModiDlg)
DDX_Control(pDX, IDC_COMBO_TYPE, m_cmb_type);
DDX_Text(pDX, IDC_EDIT_USER, m_user);
DDX_Text(pDX, IDC_EDIT_PWD, m_pwd);
DDX_CBString(pDX, IDC_COMBO_TYPE, m_type);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserModiDlg, CDialog)
//{{AFX_MSG_MAP(CUserModiDlg)
ON_BN_CLICKED(IDC_BTN_MODI, OnBtnModi)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CUserModiDlg::OnBtnModi()
{
if(!UpdateData()) return;
if(m_pwd.IsEmpty())
{
MessageBox("请输入密码!","错误");
return;
}
if(m_type.IsEmpty())
{
MessageBox("请选择用户级别!","错误");
return;
}
CString sql;
sql.Format("Update 用户表 set 密码='%s',级别='%s' where userID='%s'",m_pwd,m_type,m_user);
g_adoDB.Execute(sql);
OnCancel();
}
BOOL CUserModiDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(m_type=="管理员")
m_cmb_type.SetCurSel(0);
else if(m_type=="操作员")
m_cmb_type.SetCurSel(1);
else if(m_type=="普通用户")
m_cmb_type.SetCurSel(2);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -