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

📄 girllist.cpp

📁 简单数据库入门实例ODBC访问ACCESS,大家下一下,对学习很有帮助
💻 CPP
字号:
// GIRLLIST.cpp : implementation file
//

#include "stdafx.h"
#include "odbcdemo1.h"
#include "GIRLLIST.h"
#include "ODBCDemo1Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// GIRLLIST dialog


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


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


BEGIN_MESSAGE_MAP(GIRLLIST, CDialog)
	//{{AFX_MSG_MAP(GIRLLIST)
	ON_BN_CLICKED(IDC_List, OnList)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// GIRLLIST message handlers

void GIRLLIST::OnList() 
{
	// TODO: Add your control notification handler code here
	CODBCFieldInfo FieldInfo;//存储字段信息的结构体
	short nFields;//存储字段数目

	/*nFields=m_Set->GetODBCFieldCount();//获得字段数目
	m_Set->GetODBCFieldInfo(short(1),FieldInfo);//获得字段信息
	m_Title=FieldInfo.m_strName;
	m_Girl.InsertColumn(1,m_Title);
	m_Set->GetODBCFieldInfo(short(2),FieldInfo);
	m_Publisher=FieldInfo.m_strName;
	m_Set->GetODBCFieldInfo(short(3),FieldInfo);
	m_ISBN=FieldInfo.m_strName;
	m_Set->GetODBCFieldInfo(short(4),FieldInfo);
	m_Price=FieldInfo.m_strName;
	m_Set->GetODBCFieldInfo(short(5),FieldInfo);
	m_Author=FieldInfo.m_strName;
	m_Set->GetODBCFieldInfo(short(7),FieldInfo);
	m_Yearpublish=FieldInfo.m_strName;


    if(m_Set->IsEOF())//记录集是否为空
	{
		AfxMessageBox("记录集没有记录");
		return;
	}
	m_Set->MoveFirst();//第一个记录
	m_Set->GetFieldValue((short)1,m_Title);//把第0 列赋给此控件
    m_Set->GetFieldValue((short)2,m_Publisher);//把第1 列赋给此控件
    m_Set->GetFieldValue((short)3,m_ISBN);//把第2 列赋给此控件
	m_Set->GetFieldValue((short)4,m_Price);//把第2 列赋给此控件
	m_Set->GetFieldValue((short)5,m_Author);//把第2 列赋给此控件
	m_Set->GetFieldValue((short)7,m_Yearpublish);//把第2 列赋给此控件
	*/
}

⌨️ 快捷键说明

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