home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c09 / odbc2 / myrecordset.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.4 KB  |  74 lines

  1. // MyRecordset.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "odbc2.h"
  6. #include "MyRecordset.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMyRecordset
  16.  
  17. IMPLEMENT_DYNAMIC(CMyRecordset, CRecordset)
  18.  
  19. CMyRecordset::CMyRecordset(CDatabase* pdb)
  20.     : CRecordset(pdb)
  21. {
  22.     //{{AFX_FIELD_INIT(CMyRecordset)
  23.     m_ID = 0;
  24.     m_Field1 = _T("");
  25.     m_nFields = 2;
  26.     //}}AFX_FIELD_INIT
  27.     m_nDefaultType = snapshot;
  28.  
  29.     m_sql= _T("[Table1]");
  30.  
  31. }
  32.  
  33.  
  34. CString CMyRecordset::GetDefaultConnect()
  35. {
  36.     return _T("ODBC;DSN=TestDataSource");
  37. }
  38.  
  39. CString CMyRecordset::GetDefaultSQL()
  40. {
  41.     return _T("[Table1]");
  42. //    return _T("[Query1]");
  43. }
  44.  
  45. void CMyRecordset::DoFieldExchange(CFieldExchange* pFX)
  46. {
  47.     //{{AFX_FIELD_MAP(CMyRecordset)
  48.     pFX->SetFieldType(CFieldExchange::outputColumn);
  49.     RFX_Long(pFX, _T("[ID]"), m_ID);
  50.     RFX_Text(pFX, _T("[Field1]"), m_Field1);
  51.     //}}AFX_FIELD_MAP
  52.  
  53. }
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CMyRecordset diagnostics
  57.  
  58. #ifdef _DEBUG
  59. void CMyRecordset::AssertValid() const
  60. {
  61.     CRecordset::AssertValid();
  62. }
  63.  
  64. void CMyRecordset::Dump(CDumpContext& dc) const
  65. {
  66.     CRecordset::Dump(dc);
  67. }
  68. #endif //_DEBUG
  69.  
  70. void CMyRecordset::SetDefaultSQL(CString& sql)
  71. {
  72.      m_sql= sql;
  73. }
  74.