scoreadddlg.cpp

来自「这是一个课程设计」· C++ 代码 · 共 62 行

CPP
62
字号
// ScoreAddDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Scoremanager.h"
#include "ScoreAddDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CScoreAddDlg dialog






BEGIN_MESSAGE_MAP(CScoreAddDlg, CDialog)
	//{{AFX_MSG_MAP(CScoreAddDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScoreAddDlg message handlers

void CScoreAddDlg::OnOK() 
{
CString student,course,pscore,escore,student_no,course_no;
m_cStudent.GetWindowText(student);
m_cCourse.GetWindowText(course);
m_cPscore.GetWindowText(pscore);
m_cEscore.GetWindowText(escore);
      if(pscore==""||escore=="")
	  {
		  MessageBox("aa");
	  }
      else
	  {
		  CString strSQL;
          strSQL.Format("select*from student where active_status='Y' and student_name='%s'",student);
		  CRecordset m_recordSet=&m_database;
		  m_recordSet.Open(CRecordset::forwardOnly,strSQL);
		  m_recordSet.GetFieldValue("student_no",student_no);
		  m_recordSet.Close();
		  strSQL.Format("select*from course where active_status='Y' and course_name='%s'",course);
		  m_recordSet.Open(CRecordset::forwardOnly,strSQL);
		  m_recordSet.GetFieldValue("course_no",course_no);
		  m_recordSet.Close();
		  if(int flag=0)
		  {
			 strSQL.Format("insert score set student_no='%s',course_no='%s',score_peacetime=%s,score_exam=%s ",student_no,course_no,pscore,escore);
			 m_database.ExecuteSQL(strSQL);
		  }
		  
	CDialog::OnOK();
}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?