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

  1. // BiblioSet.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "DBAccess.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
  18.  
  19. IMPLEMENT_DYNAMIC(CBiblioSet, CDaoRecordset)
  20.  
  21. CBiblioSet::CBiblioSet(CDaoDatabase* pdb)
  22.     : CDaoRecordset(pdb)
  23. {
  24.     //{{AFX_FIELD_INIT(CBiblioSet)
  25.     m_Commands = _T("");
  26.     m_Description = _T("");
  27.     m_ISBN = _T("");
  28.     m_Notes = _T("");
  29.     m_PubID = 0;
  30.     m_Subject = _T("");
  31.     m_Title = _T("");
  32.     m_Year_Published = 0;
  33.     m_nFields = 8;
  34.     //}}AFX_FIELD_INIT
  35.     m_nDefaultType = dbOpenTable;
  36.     m_bCheckCacheForDirtyFields = FALSE;
  37. }
  38.  
  39. CString CBiblioSet::GetDefaultDBName()
  40. {
  41.     struct _finddata_t c_file;
  42.     long hFile;
  43.     CString fname = "..\\..\\biblio.mdb";
  44.  
  45.     hFile = _findfirst(fname, &c_file);
  46.  
  47.     if( -1 != hFile )
  48.         return _T(fname);
  49.  
  50.     fname = "..\\biblio.mdb";
  51.  
  52.     hFile = _findfirst(fname, &c_file);
  53.  
  54.     if( -1 != hFile )
  55.         return _T(fname);
  56.  
  57.     return _T("");
  58. }
  59.  
  60. CString CBiblioSet::GetDefaultSQL()
  61. {
  62.     return _T("[Titles]");
  63. }
  64.  
  65. void CBiblioSet::DoFieldExchange(CDaoFieldExchange* pFX)
  66. {
  67.     //{{AFX_FIELD_MAP(CBiblioSet)
  68.     pFX->SetFieldType(CDaoFieldExchange::outputColumn);
  69.     DFX_Text(pFX, _T("[Comments]"), m_Commands);
  70.     DFX_Text(pFX, _T("[Description]"), m_Description);
  71.     DFX_Text(pFX, _T("[ISBN]"), m_ISBN);
  72.     DFX_Text(pFX, _T("[Notes]"), m_Notes);
  73.     DFX_Long(pFX, _T("[PubID]"), m_PubID);
  74.     DFX_Text(pFX, _T("[Subject]"), m_Subject);
  75.     DFX_Text(pFX, _T("[Title]"), m_Title);
  76.     DFX_Short(pFX, _T("[Year Published]"), m_Year_Published);
  77.     //}}AFX_FIELD_MAP
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CBiblioSet diagnostics
  82.  
  83. #ifdef _DEBUG
  84. void CBiblioSet::AssertValid() const
  85. {
  86.     CDaoRecordset::AssertValid();
  87. }
  88.  
  89. void CBiblioSet::Dump(CDumpContext& dc) const
  90. {
  91.     CDaoRecordset::Dump(dc);
  92. }
  93. #endif //_DEBUG
  94.