studentdeletecourse.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:2k
- // studentdeletecourse.cpp : implementation file
- //
- #include "stdafx.h"
- #include "课程设计.h"
- #include "studentdeletecourse.h"
- #include "tch.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // studentdeletecourse dialog
- studentdeletecourse::studentdeletecourse(CWnd* pParent /*=NULL*/)
- : CDialog(studentdeletecourse::IDD, pParent)
- {
- //{{AFX_DATA_INIT(studentdeletecourse)
- deletecourse = _T("");
- deletestudent = _T("");
- //}}AFX_DATA_INIT
- }
- void studentdeletecourse::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(studentdeletecourse)
- DDX_Text(pDX, IDC_EDIT1, deletecourse);
- DDX_Text(pDX, IDC_EDIT2, deletestudent);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(studentdeletecourse, CDialog)
- //{{AFX_MSG_MAP(studentdeletecourse)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // studentdeletecourse message handlers
- int studentdeletecourse::DoModal()
- {
- // TODO: Add your specialized code here and/or call the base class
-
- return CDialog::DoModal();
- }
- void studentdeletecourse::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- tch a;
- a.Open();
- while(!a.IsEOF())
- {if(deletestudent==a.m_student)
- {if(deletecourse==a.m_xueke1)
- { a.Edit();
- a.m_xueke1="";
- a.Update();
- flag=1;
- break;}
- if(deletecourse==a.m_xueke2)
- {a.Edit();
- a.m_xueke2="";
- a.Update();
- flag=1;
- break;
-
- }
- if(deletecourse==a.m_xueke3)
- {a.Edit();
- a.m_xueke3="";
- a.Update();
- flag=1;
- break;
-
- }
- if(deletecourse==a.m_xueke4)
- {a.Edit();
- a.m_xueke4="";
- a.Update();
- flag=1;
- break;
-
- }
- if(deletecourse==a.m_xueke5)
- {a.Edit();
- a.m_xueke5="";
- a.Update();
- flag=1;
- break;
-
- }
- if(deletecourse==a.m_xueke6)
- {a.Edit();
- a.m_xueke6="";
- a.Update();
- flag=1;
- break;
-
- }
- if(deletecourse==a.m_xueke7)
- {a.Edit();
- a.m_xueke7="";
- a.Update();
- flag=1;
- break;
-
- }
- }
- a.MoveNext();
- }
- if(flag==0)
- {MessageBox("该用户或课程不存在!!!","提示",64);}
- if(flag==1)
- { /*a.Delete();
- a.Requery();
- UpdateData(false);*/
- MessageBox("已删除成功!","提示",64);
- this->OnCancel();
- }
- }