📄 stuonescore.cpp
字号:
// stuonescore.cpp : implementation file
//
#include "stdafx.h"
#include "mystudent.h"
#include "stuonescore.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Cstuonescore dialog
Cstuonescore::Cstuonescore(CWnd* pParent /*=NULL*/)
: CDialog(Cstuonescore::IDD, pParent)
{
//{{AFX_DATA_INIT(Cstuonescore)
m_stuname = _T("");
m_cname = _T("");
m_stuno = _T("");
m_cno = _T("");
m_stuname1 = _T("");
m_cname1 = _T("");
m_classno = _T("");
m_special = _T("");
m_score = 0.0f;
m_credit = _T("");
//}}AFX_DATA_INIT
}
void Cstuonescore::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Cstuonescore)
DDX_Text(pDX, IDC_EDIT1, m_stuname);
DDX_Text(pDX, IDC_EDIT2, m_cname);
DDX_Text(pDX, IDC_EDIT3, m_stuno);
DDX_Text(pDX, IDC_EDIT4, m_cno);
DDX_Text(pDX, IDC_EDIT5, m_stuname1);
DDX_Text(pDX, IDC_EDIT6, m_cname1);
DDX_Text(pDX, IDC_EDIT7, m_classno);
DDX_Text(pDX, IDC_EDIT8, m_special);
DDX_Text(pDX, IDC_EDIT9, m_score);
DDX_Text(pDX, IDC_EDIT10, m_credit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Cstuonescore, CDialog)
//{{AFX_MSG_MAP(Cstuonescore)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Cstuonescore message handlers
void Cstuonescore::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CDatabase m_database;
Cstudentset student;
Cscore score;
Ccourse course;
Cclassinfo classinfo;
if(student.IsOpen())
student.Close();
CString sql;
sql.Format("select * from student where stuno='%s' or stuname='%s'",m_stuno,m_stuname);
student.m_pDatabase=&m_database;
student.Open(AFX_DB_USE_DEFAULT_TYPE,sql);
if(student.IsEOF())
{
MessageBox("该学生不存在!","提示");
return;
}
else
{
sql.Format("select * from course where cno='%s' or cname='%s'",m_cno,m_cname);
course.m_pDatabase=&m_database;
course.Open(AFX_DB_USE_DEFAULT_TYPE,sql);
sql.Format("select * from score where studentno='%s' and course='%s'",
student.m_stuno,course.m_cname);
score.m_pDatabase=&m_database;
score.Open(AFX_DB_USE_DEFAULT_TYPE,sql);
if(score.IsEOF())
{
MessageBox("该学生没有该门课!","提示");
return;
}
else
{
sql.Format("select * from classinfo where classno='%s'",student.m_classno);
classinfo.m_pDatabase=&m_database;
classinfo.Open(AFX_DB_USE_DEFAULT_TYPE,sql);
m_stuname1.Format("%s",student.m_stuname);
m_cname1.Format("%s",course.m_cno);
m_classno.Format("%s",classinfo.m_classno);
m_special.Format("%s",classinfo.m_special);
m_score=(float)score.m_score;
m_credit.Format("%s",score.m_credit);
UpdateData(false);
}
}
//CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -