mynewdialog3.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:2k
- // mynewdialog3.cpp : implementation file
- //
- #include "stdafx.h"
- #include "sheji2.h"
- #include "mynewdialog3.h"
- #include "myrecordset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog3 dialog
- mynewdialog3::mynewdialog3(CWnd* pParent /*=NULL*/)
- : CDialog(mynewdialog3::IDD, pParent)
- {
- //{{AFX_DATA_INIT(mynewdialog3)
- id1 = _T("");
- name2 = _T("");
- wp2 = _T("");
- hp2 = _T("");
- fp2 = _T("");
- ip2 = _T("");
- //}}AFX_DATA_INIT
- }
- void mynewdialog3::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(mynewdialog3)
- DDX_Text(pDX, IDC_EDIT1, id1);
- DDX_Text(pDX, IDC_EDIT2, name2);
- DDX_Text(pDX, IDC_EDIT3, wp2);
- DDX_Text(pDX, IDC_EDIT4, hp2);
- DDX_Text(pDX, IDC_EDIT5, fp2);
- DDX_Text(pDX, IDC_EDIT6, ip2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(mynewdialog3, CDialog)
- //{{AFX_MSG_MAP(mynewdialog3)
- ON_COMMAND(ID_MENUITEM32775, OnMenuitem32775)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog3 message handlers
- void mynewdialog3::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- myrecordset a;
- a.Open();
- while(!a.IsEOF())
- {if(name2==a.m_name||id1==a.m_ID)
- {flag=1;
- break;}
- a.MoveNext();
- }
- if(flag==1)
- {MessageBox("该用户或ID号存在!!","警告",16);}
- if(flag==0)
- {a.MoveLast();
- a.AddNew();
- a.m_ID=id1;
- a.m_name=name2;
- a.m_workplace=wp2;
- a.m_address=hp2;
- a.m_fixphone=fp2;
- a.m_phone=ip2;
- a.Update();
- MessageBox("已成功添加!!","提示",64);
- this->OnCancel();
- }
- }
- void mynewdialog3::OnMenuitem32775()
- {
- // TODO: Add your command handler code here
-
- }