📄 querydlg.cpp
字号:
// QueryDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "QueryDlg.h"
#include "IRecset.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CQueryDlg dialog
CQueryDlg::CQueryDlg(CWnd* pParent /*=NULL*/)
: CDialog(CQueryDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CQueryDlg)
m_Age = 0;
m_ID = 0;
m_Name = _T("");
//}}AFX_DATA_INIT
}
void CQueryDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CQueryDlg)
DDX_Text(pDX, IDC_EDIT_AGE, m_Age);
DDX_Text(pDX, IDC_EDIT_ID, m_ID);
DDX_Text(pDX, IDC_EDIT_NAME, m_Name);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CQueryDlg, CDialog)
//{{AFX_MSG_MAP(CQueryDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CQueryDlg message handlers
void CQueryDlg::OnButton1()
{
CIRecordset rsQuery;
rsQuery.m_szTable = _T("Exam");
rsQuery.m_szFields = _T("[ID],[NAME],[AGE]");
rsQuery.m_szFilter = _T("[ID]=2");
// rsQuery.m_szSort = _T("[AGE]");
if( rsQuery.Open() )
{
while (!rsQuery.m_pRecord->IsEOF())
{
m_ID = rsQuery.GetFieldValueInt(0);
m_Name = rsQuery.GetFieldValueText(1);
m_Age = rsQuery.GetFieldValueSmallInt(2);
rsQuery.m_pRecord->MoveNext();
}
rsQuery.Close();
}
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -