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

📄 entity.cpp

📁 摘要:本文是笔者根据数据库编程经验
💻 CPP
字号:
// CEntity.cpp: implementation of the Entity class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Entity.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CEntity::CEntity() : m_strEntityName( TEXT("") )
{
	m_strSQL = TEXT("");
}

CEntity::CEntity(const CString& strName) : m_strEntityName(strName)
{
	m_strSQL = TEXT("");
} 

CEntity::~CEntity()
{
}

void CEntity::SetEntityName(const CString& strEntityName)
{ 
	m_strEntityName = strEntityName;
} 

CString CEntity::GetEntityName(void) const
{  
	return m_strEntityName;
}

BOOL CEntity::Initialize(CAdoConnection* pConn, BOOL bAppend)
{
	if(pConn == NULL)
		return FALSE;

	m_strEntityName.TrimLeft();
	m_strEntityName.TrimRight();	
	if(m_strEntityName.GetLength() == 0)
		return FALSE;

	m_strSQL = TEXT("Select * from ") + m_strEntityName;

	return TRUE;
}

BOOL CEntity::Append(CAdoConnection* pConn)
{
	return Initialize(pConn, TRUE);
}

BOOL CEntity::Modify(CAdoConnection* pConn)
{
	return Initialize(pConn, FALSE);
}

BOOL CEntity::Delete(CAdoConnection* pConn)
{
	return Initialize(pConn, FALSE);
}

BOOL CEntity::Read(CAdoConnection* pConn)
{
	return Initialize(pConn, FALSE);
}

BOOL CEntity::Read(CAdoRecordSet* pRs)
{
	return pRs != NULL && pRs->IsOpen();
}

⌨️ 快捷键说明

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