Click here to Skip to main content
15,885,914 members
Articles / Desktop Programming / MFC

CODBCAccess: a CDatabase and CRecordset Wrapper

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
12 Mar 200312 min read 209.6K   4.3K   55  
A class to wrap the use of CDatabase and CRecordset into one object to communicate with databases
//By: George Polouse

// Columns.h: interface for the CColumns class.
//

#if !defined(AFX_COLUMNS_H__23260973_9781_11D2_BD48_204C4F4F5020__INCLUDED_)
#define AFX_COLUMNS_H__23260973_9781_11D2_BD48_204C4F4F5020__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CColumns - results from ::SQLColumns()
#include "RecordsetEx.h"

class CColumns : public CRecordsetEx
{
public:
	CColumns(CDatabase* pDatabase);
	DECLARE_DYNAMIC(CColumns)

// Field Data
	CString m_strTableQualifier;        
	CString m_strTableOwner;        
	CString m_strTableName;        
	CString m_strColumnName;        
	int m_nDataType;        
	CString m_strTypeName;        
	long m_nPrecision;        
	long m_nLength;        
	int m_nScale;        
	int m_nRadix;        
	int m_fNullable;        
	CString m_strRemarks;        

// Operations
	BOOL Open(LPCSTR pszTableQualifier = NULL,
			 LPCSTR pszTableOwner = NULL,
			 LPCSTR pszTableName = NULL,
			 LPCSTR pszColumnName = NULL,
			 UINT   nOpenType = CRecordset::dynaset);
// Overrides
	virtual CString GetDefaultConnect();
	virtual CString GetDefaultSQL();
	virtual void DoFieldExchange(CFieldExchange*);

// Implementation
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif
};

#endif // !defined(AFX_COLUMNS_H__23260973_9781_11D2_BD48_204C4F4F5020__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
I work with C++, C#, Perl, PHP, HTML (with a lot of CSS), and a little bit of ASP.NET. I have been programming for 7 years.

I also enjoy translating Latin, and especially reading authors whose primary language was Latin, including Virgil (or Vergil for the Latinate spelling), Julius Caesar, Catullus, Cicero, and some others (like Martial). I enjoy classical music, most especially Mozart and Bach.

Comments and Discussions