historydlg.cpp

来自「银行管理系统,在VisualC++中操作SQL数据库进行银行帐号的创建,删除,修」· C++ 代码 · 共 67 行

CPP
67
字号
// HistoryDlg.cpp : 实现文件
//

#include "stdafx.h"
#include "BankSystem.h"
#include "HistoryDlg.h"
#include ".\historydlg.h"


// HistoryDlg 对话框

IMPLEMENT_DYNAMIC(HistoryDlg, CDialog)
HistoryDlg::HistoryDlg(CWnd* pParent /*=NULL*/)
	: CDialog(HistoryDlg::IDD, pParent)
{
}

HistoryDlg::~HistoryDlg()
{
}

void HistoryDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_LIST1, List1);
}


BEGIN_MESSAGE_MAP(HistoryDlg, CDialog)
	ON_BN_CLICKED(IDC_Cancel, OnBnClickedCancel)
	ON_BN_CLICKED(IDC_ListRec, OnBnClickedListrec)
END_MESSAGE_MAP()


// HistoryDlg 消息处理程序

void HistoryDlg::OnBnClickedCancel()
{
	// TODO: 在此添加控件通知处理程序代码
	OnOK();
}


void HistoryDlg::OnBnClickedListrec()
{
	// TODO: 在此添加控件通知处理程序代码
	CString strQuery="SELECT * FROM argue";
	


	try{
		pRst=pConn->Execute(_bstr_t(strQuery),NULL,adCmdText);
	}
	catch(_com_error &e)
	{
		MessageBox(e.ErrorMessage()); 
		return ;
	}

	while(!pRst->rsEOF)//将查询到的数据加到列表框咯。
	{
		CString str=""+(_bstr_t)pRst->GetCollect("uname")+"  "+(_bstr_t)pRst->GetCollect("topic")+"  "+(_bstr_t)pRst->GetCollect("content")+"";
		
		List1.AddString(str);
		pRst->MoveNext();
	}
}

⌨️ 快捷键说明

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