mynewdialog4.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:1k
- // mynewdialog4.cpp : implementation file
- //
- #include "stdafx.h"
- #include "sheji2.h"
- #include "mynewdialog4.h"
- #include "myrecordset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog4 dialog
- mynewdialog4::mynewdialog4(CWnd* pParent /*=NULL*/)
- : CDialog(mynewdialog4::IDD, pParent)
- {
- //{{AFX_DATA_INIT(mynewdialog4)
- deletename = _T("");
- //}}AFX_DATA_INIT
- }
- void mynewdialog4::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(mynewdialog4)
- DDX_Text(pDX, IDC_EDIT1, deletename);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(mynewdialog4, CDialog)
- //{{AFX_MSG_MAP(mynewdialog4)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // mynewdialog4 message handlers
- void mynewdialog4::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- myrecordset a;
- a.Open();
- while(!a.IsEOF())
- {if(deletename==a.m_name)
- {flag=1;
- break;}
- a.MoveNext();
- }
- if(flag==0)
- {MessageBox("该用户不存在!!!","提示",64);}
- if(flag==1)
- { a.Delete();
- a.Requery();
- UpdateData(false);
- MessageBox("已删除成功!","提示",64);
- this->OnCancel();
- }
- }