home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c08 / where / bibset.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.0 KB  |  90 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 = dbOpenDynaset;
  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.     if (-1 != hFile)
  46.         return _T(fname);
  47.  
  48.     fname = "..\\biblio.mdb";
  49.     hFile = _findfirst(fname, &c_file);
  50.     if (-1 != hFile)
  51.         return _T(fname);
  52.  
  53.     return _T("");
  54. }
  55.  
  56. CString CBiblioSet::GetDefaultSQL()
  57. {
  58.     return _T("[Titles]");
  59. }
  60.  
  61. void CBiblioSet::DoFieldExchange(CDaoFieldExchange* pFX)
  62. {
  63.     //{{AFX_FIELD_MAP(CBiblioSet)
  64.     pFX->SetFieldType(CDaoFieldExchange::outputColumn);
  65.     DFX_Text(pFX, _T("[Title]"), m_Title);
  66.     DFX_Short(pFX, _T("[Year Published]"), m_Year_Published);
  67.     DFX_Text(pFX, _T("[ISBN]"), m_ISBN);
  68.     DFX_Long(pFX, _T("[PubID]"), m_PubID);
  69.     DFX_Text(pFX, _T("[Description]"), m_Description);
  70.     DFX_Text(pFX, _T("[Notes]"), m_Notes);
  71.     DFX_Text(pFX, _T("[Subject]"), m_Subject);
  72.     DFX_Text(pFX, _T("[Comments]"), m_Comments);
  73.     //}}AFX_FIELD_MAP
  74. }
  75.  
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CBiblioSet diagnostics
  78.  
  79. #ifdef _DEBUG
  80. void CBiblioSet::AssertValid() const
  81. {
  82.     CDaoRecordset::AssertValid();
  83. }
  84.  
  85. void CBiblioSet::Dump(CDumpContext& dc) const
  86. {
  87.     CDaoRecordset::Dump(dc);
  88. }
  89. #endif //_DEBUG
  90.