addstudentinfor.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:2k
- // addstudentinfor.cpp : implementation file
- //
- #include "stdafx.h"
- #include "课程设计.h"
- #include "addstudentinfor.h"
- #include "tch.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // addstudentinfor dialog
- addstudentinfor::addstudentinfor(CWnd* pParent /*=NULL*/)
- : CDialog(addstudentinfor::IDD, pParent)
- {
- //{{AFX_DATA_INIT(addstudentinfor)
- sid = _T("");
- sname = _T("");
- ssex = _T("");
- sclass = _T("");
- skecheng1 = _T("");
- skecheng2 = _T("");
- skecheng3 = _T("");
- skecheng4 = _T("");
- skecheng5 = _T("");
- skecheng6 = _T("");
- skecheng7 = _T("");
- //}}AFX_DATA_INIT
- }
- void addstudentinfor::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(addstudentinfor)
- DDX_Text(pDX, IDC_EDIT1, sid);
- DDX_Text(pDX, IDC_EDIT2, sname);
- DDX_Text(pDX, IDC_EDIT3, ssex);
- DDX_Text(pDX, IDC_EDIT4, sclass);
- DDX_Text(pDX, IDC_EDIT5, skecheng1);
- DDX_Text(pDX, IDC_EDIT6, skecheng2);
- DDX_Text(pDX, IDC_EDIT7, skecheng3);
- DDX_Text(pDX, IDC_EDIT8, skecheng4);
- DDX_Text(pDX, IDC_EDIT9, skecheng5);
- DDX_Text(pDX, IDC_EDIT10, skecheng6);
- DDX_Text(pDX, IDC_EDIT11, skecheng7);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(addstudentinfor, CDialog)
- //{{AFX_MSG_MAP(addstudentinfor)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // addstudentinfor message handlers
- void addstudentinfor::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- int flag=0;
- tch a;
- a.Open();
- while(!a.IsEOF())
- {if(sname==a.m_student)
- {flag=1;
- break;}
- a.MoveNext();
- }
- if(flag==1)
- {MessageBox("该学生已存在!!");
-
- }
- if(flag==0)
- { a.AddNew();
- a.m_ID=sid;
- a.m_student=sname;
- a.m_class=sclass;
- a.m_sex=ssex;
- a.m_xueke1=skecheng1;
- a.m_xueke2=skecheng2;
- a.m_xueke3=skecheng3;
- a.m_xueke4=skecheng4;
- a.m_xueke5=skecheng5;
- a.m_xueke6=skecheng6;
- a.m_xueke7=skecheng7;
- a.Update();
- this->OnCancel();
- MessageBox("新生注册成功!!","提示",64);}
-
- }