EmpList.cpp
上传用户:jimmy1212
上传日期:2020-11-02
资源大小:40k
文件大小:2k
- // 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 = ' ';
- end = strrchr(aDir,'\');
- if(end)
- *end = ' ';
- _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