mynewdialog5.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:3k
- // mynewdialog5.cpp : implementation file
- //
- #include "stdafx.h"
- #include "sheji2.h"
- #include "mynewdialog5.h"
- #include "myrecordset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog5 dialog
- mynewdialog5::mynewdialog5(CWnd* pParent /*=NULL*/)
- : CDialog(mynewdialog5::IDD, pParent)
- {
- //{{AFX_DATA_INIT(mynewdialog5)
- findname = _T("");
- id5 = _T("");
- name5 = _T("");
- wp5 = _T("");
- hp5 = _T("");
- fp5 = _T("");
- ip5 = _T("");
- //}}AFX_DATA_INIT
- }
- void mynewdialog5::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(mynewdialog5)
- DDX_Control(pDX, IDC_EDIT7, m_edit7);
- DDX_Control(pDX, IDC_EDIT6, m_edit6);
- DDX_Control(pDX, IDC_EDIT5, m_edit5);
- DDX_Control(pDX, IDC_EDIT4, m_edit4);
- DDX_Control(pDX, IDC_EDIT3, m_edit3);
- DDX_Control(pDX, IDC_EDIT2, m_edit2);
- DDX_Control(pDX, IDC_EDIT1, m_edit);
- DDX_Text(pDX, IDC_EDIT1, findname);
- DDX_Text(pDX, IDC_EDIT2, id5);
- DDX_Text(pDX, IDC_EDIT3, name5);
- DDX_Text(pDX, IDC_EDIT4, wp5);
- DDX_Text(pDX, IDC_EDIT5, hp5);
- DDX_Text(pDX, IDC_EDIT6, fp5);
- DDX_Text(pDX, IDC_EDIT7, ip5);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(mynewdialog5, CDialog)
- //{{AFX_MSG_MAP(mynewdialog5)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog5 message handlers
- BOOL mynewdialog5::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- m_edit.SetWindowText("请输入你所要查询人的姓名");
- m_edit2.SetReadOnly();
- m_edit3.SetReadOnly();
- m_edit4.SetReadOnly();
- m_edit5.SetReadOnly();
- m_edit6.SetReadOnly();
- m_edit7.SetReadOnly();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void mynewdialog5::OnOK()
- {
- // TODO: Add extra validation here
- static int k=0;
- UpdateData();
- myrecordset a;
- a.Open();
- int flag=0;
- k++;
- while(!a.IsEOF())
- {if(findname==a.m_name)
- {flag=1;
- break;
- }
- a.MoveNext();
- }
- if(flag==1)
- {m_edit2.SetReadOnly(false);
- m_edit3.SetReadOnly(false);
- m_edit4.SetReadOnly(false);
- m_edit5.SetReadOnly(false);
- m_edit6.SetReadOnly(false);
- m_edit7.SetReadOnly(false);
- id5=a.m_ID;
- name5=a.m_name;
- wp5=a.m_workplace;
- hp5=a.m_address;
- fp5=a.m_fixphone;
- ip5=a.m_phone;
- UpdateData(false);
-
- }
- else
- {MessageBox("记录中无此资源","提示",64);
- k--;
- }
- if(k==2)
- {this->OnCancel();}
-
- }