以下是我的源码:
/////////////////h file
#ifndef _SECTIONBASE_H
#define _SECTIONBASE_H#include "mydefine.h"
#include "RecSectionSet.h"class CSectionBase : public CObject
{
public:
CSectionBase();
~CSectionBase();
protected:
CDatabase* pDatabase;
CRecSectionSet* pSecSet;public:
BOOL GetAllSection(CMapWordToPtr* pList);
BOOL    ModifySectionStore(STOREBASE* store);
}#endif// cpp file:
#include "stdafx.h"
#include "videograbber.h"
#include "sectionbase.h"
#include "mydefine.h"CSectionBase::CSectionBase()
{
pDatabase = NULL;
pDatabase = new CDatabase;
if( pDatabase != NULL)
{
if(!pDatabase->Open("vsection"))
{
AfxMessageBox("无法打开数据连接");
}
}
pSecSet = NULL;}CSectionBase :: ~CSectionBase()
{
if( pDatabase->IsOpen() )
pDatabase->Close(); delete pDatabase;
}BOOL CSectionBase::GetAllSection(CMapWordToPtr* pList)
{
pSecSet = new CRecSectionSet;
if( pSecSet == NULL )
return FALSE; pSecSet->m_pDatabase = pDatabase;
pSecSet->m_strSort   = "窗口号"; if( !pSecSet->Open(CRecordset::snapshot) )
{
if( pSecSet->IsOpen() )
pSecSet->Close();
delete pSecSet;
return FALSE;
} if( pSecSet->IsEOF() && pSecSet->IsBOF() )
{
if( pSecSet->IsOpen() )
pSecSet->Close();
delete pSecSet;
return TRUE;
} while( !pSecSet->IsEOF() )
{
STOREBASE* pObj = new STOREBASE;
//pObj
}}BOOL CSectionBase::ModifySectionStore(STOREBASE* store)
{
return FALSE;
}