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

📄 history.cpp

📁 sadfsdafsd sadfsdafsd sadfsdafsd sadfsdafsd sadfsdafsd sadfsdafsd sadfsdafsd
💻 CPP
字号:
// History.cpp : implementation file
//

#include "stdafx.h"
#include "教学管理系统.h"
#include "History.h"

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

/////////////////////////////////////////////////////////////////////////////
// History dialog


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


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

BOOL History::OnInitDialog()
{
	CString sSql,a,b,c;
	CDialog::OnInitDialog();
    DWORD dwExStyle=LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP;  
    historylist.SetExtendedStyle(dwExStyle);     
    historylist.InsertColumn(0,"时间",LVCFMT_CENTER,200);
    historylist.InsertColumn(0,"类别",LVCFMT_CENTER,140);
	historylist.InsertColumn(0,"学号",LVCFMT_CENTER,130);
	connection.Initialize();
	sSql.Format("select * from 学生历史 order by 时间");
	connection.Connect(sSql);
	historylist.DeleteAllItems();
	if((connection.m_pRecordset->adoEOF))
	{
		AfxMessageBox("没有历史记录");
		connection.Unitialize();
		return false;
	}	
    connection.m_pRecordset->MoveFirst();
	while(!connection.m_pRecordset->adoEOF)
	{     
		_variant_t TheValue; 
		TheValue = connection.m_pRecordset->Fields->GetItem("学号")->Value;
		a=TheValue.bstrVal;
		
		TheValue = connection.m_pRecordset->Fields->GetItem("类别")->Value;
		b=TheValue.bstrVal;
		
		TheValue = connection.m_pRecordset->Fields->GetItem("时间")->Value;
		c=TheValue.bstrVal;
        
        int nIndex= historylist.InsertItem(0,a);
        historylist.SetItemText(nIndex,1,b );
        historylist.SetItemText(nIndex,2,c);
		connection.m_pRecordset->MoveNext();
	}   
	connection.Unitialize();
	return TRUE;  // return TRUE unless you set the focus to a control
}

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

/////////////////////////////////////////////////////////////////////////////
// History message handlers

void History::OnCancel() 
{
	// TODO: Add extra cleanup here	
	EndDialog(0);
}

⌨️ 快捷键说明

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