deletest.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:1k
- // deletest.cpp : implementation file
- //
- #include "stdafx.h"
- #include "课程设计.h"
- #include "deletest.h"
- #include "userviewdialog.h"
- #include "tch.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // deletest dialog
- deletest::deletest(CWnd* pParent /*=NULL*/)
- : CDialog(deletest::IDD, pParent)
- {
- //{{AFX_DATA_INIT(deletest)
- deletestudentname = _T("");
- //}}AFX_DATA_INIT
- }
- void deletest::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(deletest)
- DDX_Text(pDX, IDC_EDIT1, deletestudentname);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(deletest, CDialog)
- //{{AFX_MSG_MAP(deletest)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // deletest message handlers
- void deletest::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- userviewdialog b;
- tch a;
- a.Open();
- int flag=0;
- //if(b.studentsecret=="888")elseMessageBox("请先输入密码!!!","警告",16);
-
- while(!a.IsEOF())
- {if(deletestudentname==a.m_student)
- {flag=1;
- break;}
- a.MoveNext();
- }
- if(flag==0)
- {MessageBox("该学生不存在!!!","提示",64);}
- if(flag==1)
- { a.Delete();
- a.Requery();
- UpdateData(false);
- MessageBox("已删除成功!","提示",64);
- this->OnCancel();
- }
- //elseMessageBox("请先输入密码!!!","警告",16);
-
- }