⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scoretable.cpp

📁 是学生管理系统,本年的数据库作业,是本人完成的第一个管理系统.
💻 CPP
字号:
// scoretable.cpp : implementation file
//

#include "stdafx.h"
#include "Database1.h"
#include "scoretable.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CDatabase1App theApp;
/////////////////////////////////////////////////////////////////////////////
// scoretable dialog


scoretable::scoretable(CWnd* pParent /*=NULL*/)
	: CDialog(scoretable::IDD, pParent)
{
	//{{AFX_DATA_INIT(scoretable)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void scoretable::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(scoretable)
	DDX_Control(pDX, IDC_LIST1, m_showscotle);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(scoretable, CDialog)
	//{{AFX_MSG_MAP(scoretable)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// scoretable message handlers

void scoretable::OnButton1() 
{   
CRecordset rs(theApp.GetDBConnect());
	//now i can receive the code or words from the dialog;
rs.Open(CRecordset::dynaset,"SELECT XH,KCH,CJ FROM scoretable",CRecordset::executeDirect);


    int i = 0;
	m_showscotle.DeleteAllItems();
	while(!rs.IsEOF())
	{
		
		CString sNumber;
		CString sCourseno;
		CString sScore;
		

		rs.GetFieldValue("XH",sNumber);
    	rs.GetFieldValue("CJ",sScore);
		rs.GetFieldValue("KCH",sCourseno);
       	m_showscotle.InsertItem(i,sNumber);
		m_showscotle.SetItemText(i,1,sCourseno);
		m_showscotle.SetItemText(i,2,sScore);
	

	
		rs.MoveNext();
	}
	
}

BOOL scoretable::OnInitDialog()
{
    CDialog::OnInitDialog();
	long lStyleOld,lStyle;
	lStyle=LVS_REPORT;
	lStyleOld = GetWindowLong(m_showscotle.m_hWnd, GWL_STYLE);
	lStyleOld &= ~(LVS_TYPEMASK);  // 取消所有显示风格
	lStyleOld |= lStyle;        // 设置新的风格
	SetWindowLong(m_showscotle.m_hWnd, GWL_STYLE, lStyleOld);

	m_showscotle.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	m_showscotle.DeleteAllItems();
	m_showscotle.InsertColumn(0,"学号",LVCFMT_LEFT,-1,-1);
	m_showscotle.InsertColumn(1,"课程号",LVCFMT_LEFT,-1,-1);
	m_showscotle.InsertColumn(2,"成绩",LVCFMT_LEFT,-1,-1);

	m_showscotle.SetColumnWidth(0,100);
	m_showscotle.SetColumnWidth(1,120);
	m_showscotle.SetColumnWidth(2,100);
	
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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