📄 emplist.cpp
字号:
// EmpList.cpp : implementation file
//
#include "stdafx.h"
#include "EmpList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEmpList
IMPLEMENT_DYNAMIC(CEmpList, CDaoRecordset)
CEmpList::CEmpList(CDaoDatabase* pdb)
: CDaoRecordset(pdb)
{
//{{AFX_FIELD_INIT(CEmpList)
m_FirstName = _T("");
m_LastName = _T("");
m_DeptName = _T("");
m_DeptID = 0;
m_Salary = 0.0;
m_nFields = 5;
//}}AFX_FIELD_INIT
m_nDefaultType = dbOpenSnapshot;
}
// Return the path to the database. This should be in the executable\..\..
// directory
CString CEmpList::GetDefaultDBName()
{
char aExePath[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char *end;
::GetModuleFileName( AfxGetApp()->m_hInstance, aExePath,sizeof(aExePath));
_splitpath(aExePath,aDrive,aDir,NULL,NULL);
end = strrchr(aDir,'\\');
if(end)
*end = '\0';
end = strrchr(aDir,'\\');
if(end)
*end = '\0';
_makepath(aExePath,aDrive, aDir, "Test",".mdb");
CString aPath( aExePath );
return aPath;
//return _T("D:\\user\\Reports\\SampleReport\\Test.mdb");
}
CString CEmpList::GetDefaultSQL()
{
return _T("[ByDept]");
}
void CEmpList::DoFieldExchange(CDaoFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CEmpList)
pFX->SetFieldType(CDaoFieldExchange::outputColumn);
DFX_Text(pFX, _T("[FirstName]"), m_FirstName);
DFX_Text(pFX, _T("[LastName]"), m_LastName);
DFX_Text(pFX, _T("[DeptName]"), m_DeptName);
DFX_Short(pFX, _T("[DeptID]"), m_DeptID);
DFX_Double(pFX, _T("[Salary]"), m_Salary);
//}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CEmpList diagnostics
#ifdef _DEBUG
void CEmpList::AssertValid() const
{
CDaoRecordset::AssertValid();
}
void CEmpList::Dump(CDumpContext& dc) const
{
CDaoRecordset::Dump(dc);
}
#endif //_DEBUG
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -