📄 mima.cpp
字号:
// mima.cpp : implementation file
//
#include "stdafx.h"
#include "khmanager.h"
#include "mima.h"
#include "ado.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// mima dialog
mima::mima(CWnd* pParent /*=NULL*/)
: CDialog(mima::IDD, pParent)
{
//{{AFX_DATA_INIT(mima)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void mima::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(mima)
DDX_Control(pDX, IDC_COMBO1, m_com1);
DDX_Control(pDX, IDC_EDIT3, m_edit3);
DDX_Control(pDX, IDC_EDIT2, m_edit2);
DDX_Control(pDX, IDC_EDIT1, m_edit1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(mima, CDialog)
//{{AFX_MSG_MAP(mima)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// mima message handlers
BOOL mima::OnInitDialog()
{
CDialog::OnInitDialog();
ado rst;
rst.Open("select * from tb_user",adCmdText);
int rstnum=rst.GetRecordCount();
int i;
for(i=1;i<=rstnum;i++)
{
this->m_com1.AddString(rst.GetFieldValue("user_name"));
rst.Move(i);
}
rst.close();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void mima::OnButton2()
{
this->EndDialog(true);
}
void mima::OnButton1()
{
ado rst;
CString edit1,edit2,edit3,name,mima,SQL,zz,TSQL;
this->m_com1.GetWindowText(name);
if(name.IsEmpty())
{MessageBox("请选择用户","提示");
return;}
SQL.Format("select * from tb_user where user_name = '%s'",name);
rst.Open(SQL,adCmdText);
zz=rst.GetFieldValue("user_mm");
zz.TrimRight();
zz.TrimLeft();
this->m_edit1.GetWindowText(edit1);
if(zz.Compare(edit1))
{MessageBox("密码不正确","提示");
return;}
this->m_edit2.GetWindowText(edit2);
this->m_edit3.GetWindowText(edit3);
if(edit2.Compare(edit3))
{MessageBox("两次密码不同","提示");
return;}
TSQL.Format("UPDATE tb_user set user_mm='%s' where user_name ='%s'",edit2,name);
rst.ExecuteSQL(TSQL);
rst.close();
MessageBox("修改成功","提示");
this->m_com1.SetWindowText("");
this->m_edit1.SetWindowText("");
this->m_edit2.SetWindowText("");
this->m_edit3.SetWindowText("");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -