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

📄 daoset.cpp

📁 Visual C++下的界面设计
💻 CPP
字号:
// DaoSet.cpp : implementation of the CDAORecordset class
//

#include "stdafx.h"
#include "MSDIApp.h"
#include "MSDIDao.h"

#include "DaoSet.h"

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

LPCSTR lpcsPrimaryKey = "PrimaryKey";

/////////////////////////////////////////////////////////////////////////////
// CDAORecordset implementation

IMPLEMENT_DYNAMIC(CDAORecordset, CDaoRecordset)

CDAORecordset::CDAORecordset(CDaoDatabase* pdb)
	: CDaoRecordset(pdb)
{
  m_OpenCount = 0;
  m_strKey = lpcsPrimaryKey;
}

CDAORecordset::~CDAORecordset()
{
  ASSERT(m_OpenCount == 0);
}

void CDAORecordset::Open(int nOpenType, LPCTSTR lpszSQL, int nOptions)
{
  if (m_OpenCount == 0)
  {
    CDaoRecordset::Open(nOpenType, lpszSQL, nOptions);
    if (!m_strKey.IsEmpty()) SetCurrentIndex(m_strKey);
    m_pDatabase->GetTableDefInfo(GetName(), m_TableDefInfo, AFX_DAO_ALL_INFO);
  }
  m_OpenCount++;
}

void CDAORecordset::Close()
{
  if (IsOpen())
  {
    if (m_OpenCount) m_OpenCount--;
    if (m_OpenCount == 0) CDaoRecordset::Close();
  }
  else ASSERT(m_OpenCount == 0);
}

long CDAORecordset::GetRecordCount()
{
  // refresh the TableDefInfo values
  m_pDatabase->GetTableDefInfo(GetName(), m_TableDefInfo, AFX_DAO_ALL_INFO);
  return m_TableDefInfo.m_lRecordCount;
}

⌨️ 快捷键说明

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