studentfixcourse.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:3k
- // studentfixcourse.cpp : implementation file
- //
- #include "stdafx.h"
- #include "课程设计.h"
- #include "studentfixcourse.h"
- #include "tch.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // studentfixcourse dialog
- studentfixcourse::studentfixcourse(CWnd* pParent /*=NULL*/)
- : CDialog(studentfixcourse::IDD, pParent)
- {
- //{{AFX_DATA_INIT(studentfixcourse)
- fixcourse = _T("");
- student = _T("");
- newcourse = _T("");
- //}}AFX_DATA_INIT
- }
- void studentfixcourse::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(studentfixcourse)
- DDX_Text(pDX, IDC_EDIT1, fixcourse);
- DDX_Text(pDX, IDC_EDIT2, student);
- DDX_Text(pDX, IDC_EDIT3, newcourse);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(studentfixcourse, CDialog)
- //{{AFX_MSG_MAP(studentfixcourse)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // studentfixcourse message handlers
- int studentfixcourse::DoModal()
- {
- // TODO: Add your specialized code here and/or call the base class
-
- return CDialog::DoModal();
- }
- void studentfixcourse::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- tch a;
- a.Open();
- while(!a.IsEOF())
- {if(student==a.m_student)
- {if(fixcourse==a.m_xueke1)
- { a.Edit();
-
- a.m_xueke1=newcourse;
- a.Update();
- //a.Requery();
- flag=1;
- break;}
- if(fixcourse==a.m_xueke2)
- {a.Edit();
- a.m_xueke2=newcourse;
- a.Update();
- //a.Requery();
- flag=1;
- break;
-
- }
- if(fixcourse==a.m_xueke3)
- {a.Edit();
- a.m_xueke3=newcourse;
- a.Update();
- //.Requery();
- flag=1;
- break;
-
- }
- if(fixcourse==a.m_xueke4)
- {a.Edit();
- a.m_xueke4=newcourse;
- a.Update();
- // a.Requery();
- flag=1;
- break;
-
- }
- if(fixcourse==a.m_xueke5)
- {a.Edit();
- a.m_xueke5=newcourse;
- a.Update();
- //a.Requery();
- flag=1;
- break;
-
- }
- if(fixcourse==a.m_xueke6)
- {a.Edit();
- a.m_xueke6=newcourse;
- a.Update();
- //a.Requery();
- flag=1;
- break;
-
- }
- if(fixcourse==a.m_xueke7)
- { a.Edit();
- //a.m_xueke7="";
- a.m_xueke7=newcourse;
- 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();
- }
- }