mynewdialog2.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:2k
- // mynewdialog2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "sheji2.h"
- #include "mynewdialog2.h"
- #include "myrecordset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog2 dialog
- mynewdialog2::mynewdialog2(CWnd* pParent /*=NULL*/)
- : CDialog(mynewdialog2::IDD, pParent)
- {
- //{{AFX_DATA_INIT(mynewdialog2)
- name1 = _T("");
- wp1 = _T("");
- currentwp = _T("");
- fp1 = _T("");
- currentfp = _T("");
- //}}AFX_DATA_INIT
- }
- void mynewdialog2::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(mynewdialog2)
- DDX_Text(pDX, IDC_EDIT1, name1);
- DDX_Text(pDX, IDC_EDIT2, wp1);
- DDX_Text(pDX, IDC_EDIT3, currentwp);
- DDX_Text(pDX, IDC_EDIT4, fp1);
- DDX_Text(pDX, IDC_EDIT5, currentfp);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(mynewdialog2, CDialog)
- //{{AFX_MSG_MAP(mynewdialog2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog2 message handlers
- void mynewdialog2::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- myrecordset a;
- a.Open();
- while(!a.IsEOF())
- {if(name1==a.m_name&&wp1==a.m_workplace&&fp1==a.m_fixphone)
- {flag=1;
- a.Edit();
- a.m_workplace=currentwp;
- a.m_fixphone=currentfp;
- a.Update();
- break;}
- a.MoveNext();
- }
- if(flag==1)
- {MessageBox("该用户工作地点及其固定电话已经修改成功!!");
- this->OnCancel();
- }
- if(flag==0)
- {MessageBox("用户名与密码错误!!","警告",16);}
- }