college_selectdlg.cpp
来自「这是一个学生管理系统 包含学生基本信息 选课信息 宿舍信息 教师信息 课程信息 」· C++ 代码 · 共 118 行
CPP
118 行
// College_selectdlg.cpp : implementation file
//
#include "stdafx.h"
#include "Student.h"
#include "College_selectdlg.h"
#include "myrecord.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCollege_selectdlg dialog
CCollege_selectdlg::CCollege_selectdlg(CWnd* pParent /*=NULL*/)
: CDialog(CCollege_selectdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCollege_selectdlg)
m_year = 0;
m_college = _T("");
//}}AFX_DATA_INIT
}
void CCollege_selectdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCollege_selectdlg)
DDX_Control(pDX, IDC_SPIN1, m_spin);
DDX_Control(pDX, IDC_COMBO_COLLEGE, m_combobox);
DDX_Text(pDX, IDC_EDIT_YEAR, m_year);
DDX_CBString(pDX, IDC_COMBO_COLLEGE, m_college);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCollege_selectdlg, CDialog)
//{{AFX_MSG_MAP(CCollege_selectdlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCollege_selectdlg message handlers
BOOL CCollege_selectdlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CMyRecord rs(m_pDB);
CString strValue,strTemp;
BOOL Success;
Success=rs.OpenTable("select college_no,name from College","学院信息");
if (Success )
{
while(!rs.IsEOF())
{
rs.GetFieldValue((short)0,strValue);
rs.GetFieldValue((short)1,strTemp);
strValue+='-'+strTemp;
m_combobox.AddString(strValue);
rs.MoveNext();
}
rs.Close();
}
Success=rs.OpenTable("select to_char(sysdate,\'yyyy\') from dual","系统时间");
if ( Success)
{
if(!rs.IsEOF())
{
rs.GetFieldValue((short)0,strValue);
m_year=atoi(strValue);
}
rs.Close();
}
else
m_year=2008;
m_spin.SetRange(2000,2018);
m_spin.SetPos(m_year);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCollege_selectdlg::OnOK()
{
// TODO: Add extra validation here
CString strValue;
UpdateData();
int temp =atoi(m_college);
if(temp==-1)
return;
//if (m_chk_phone && m_dir.IsEmpty())
// return;
if (temp>-1)
{
m_combobox.GetLBText(temp,strValue);
m_CollegeNo=strValue.Left(2);
CDialog::OnOK();
}
CDialog::OnOK();
}
void CCollege_selectdlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?