home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c08 / add_del / bibset.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.1 KB  |  100 lines

  1. // BiblioSet.cpp : implementation of the CBiblioSet class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Biblio.h"
  6. #include "BibSet.h"
  7.  
  8. #include <io.h>
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CBiblioSet implementation
  18.  
  19. IMPLEMENT_DYNAMIC(CBiblioSet, CDaoRecordset)
  20.  
  21. CBiblioSet::CBiblioSet(CDaoDatabase* pdb)
  22.     : CDaoRecordset(pdb)
  23. {
  24.     //{{AFX_FIELD_INIT(CBiblioSet)
  25.     m_Title = _T("");
  26.     m_Year_Published = 0;
  27.     m_ISBN = _T("");
  28.     m_PubID = 0;
  29.     m_Description = _T("");
  30.     m_Notes = _T("");
  31.     m_Subject = _T("");
  32.     m_Comments = _T("");
  33.     m_nFields = 8;
  34.     //}}AFX_FIELD_INIT
  35.     m_nDefaultType = dbOpenTable;
  36. }
  37.  
  38. CString CBiblioSet::GetDefaultDBName()
  39. {
  40.     struct _finddata_t c_file;
  41.     long hFile;
  42.     CString fname = "..\\..\\biblio.mdb";
  43.  
  44.     hFile = _findfirst(fname, &c_file);
  45.  
  46.     if( -1 != hFile )
  47.         return _T(fname);
  48.  
  49.     fname = "..\\biblio.mdb";
  50.  
  51.     hFile = _findfirst(fname, &c_file);
  52.  
  53.     if( -1 != hFile )
  54.         return _T(fname);
  55.  
  56.     return _T("");
  57. }
  58.  
  59. CString CBiblioSet::GetDefaultSQL()
  60. {
  61.     return _T("[Titles]");
  62. }
  63.  
  64. void CBiblioSet::DoFieldExchange(CDaoFieldExchange* pFX)
  65. {
  66.     //{{AFX_FIELD_MAP(CBiblioSet)
  67.     pFX->SetFieldType(CDaoFieldExchange::outputColumn);
  68.     DFX_Text(pFX, _T("[Title]"), m_Title);
  69.     DFX_Short(pFX, _T("[Year Published]"), m_Year_Published);
  70.     DFX_Text(pFX, _T("[ISBN]"), m_ISBN);
  71.     DFX_Long(pFX, _T("[PubID]"), m_PubID);
  72.     DFX_Text(pFX, _T("[Description]"), m_Description);
  73.     DFX_Text(pFX, _T("[Notes]"), m_Notes);
  74.     DFX_Text(pFX, _T("[Subject]"), m_Subject);
  75.     DFX_Text(pFX, _T("[Comments]"), m_Comments);
  76.     //}}AFX_FIELD_MAP
  77. }
  78.  
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CBiblioSet diagnostics
  81.  
  82. #ifdef _DEBUG
  83. void CBiblioSet::AssertValid() const
  84. {
  85.     CDaoRecordset::AssertValid();
  86. }
  87.  
  88. void CBiblioSet::Dump(CDumpContext& dc) const
  89. {
  90.     CDaoRecordset::Dump(dc);
  91. }
  92. #endif //_DEBUG
  93.  
  94. void CBiblioSet::Move(long lRows) 
  95. {
  96.     // TODO: Add your specialized code here and/or call the base class
  97.     
  98.     CDaoRecordset::Move(lRows);
  99. }
  100.