Click here to Skip to main content
15,891,828 members
Articles / Database Development / SQL Server

High Performance OLE DB library : Ease of ADO, power of OLE DB

Rate me:
Please Sign up or sign in to vote.
2.50/5 (6 votes)
2 Dec 20013 min read 83.3K   3.4K   41  
Introduction to OLE DB extended classes
//*************************************************************************************
//			SALESMAN TABLE ACCESSOR
//*************************************************************************************

class CSalesManAccessor
{
public:
	LONG m_SalesManID;
	TCHAR m_SalesManName[31];

	ULONG m_SalesManID_status; // Autonumber

BEGIN_COLUMN_MAP(CSalesManAccessor)
	COLUMN_ENTRY_STATUS(1, m_SalesManID, m_SalesManID_status)
	COLUMN_ENTRY(2, m_SalesManName)
END_COLUMN_MAP()

DEFINE_COMMAND(CSalesManAccessor, _T("SELECT SalesManID, SalesManName  FROM SalesMan"))

	void ClearRecord()
	{
		memset(this, 0, sizeof(*this));
	}
};

//*************************************************************************************
//			CUSTOMER TABLE ACCESSOR
//*************************************************************************************

class CCustomerAccessor
{
public:
	TCHAR m_Address[51];
	LONG m_CustomerID;
	TCHAR m_CustomerName[31];
	LONG m_SalesManID;

	ULONG m_CustomerID_status;	// Autonumber
	ULONG m_Address_status;		// Allows null

BEGIN_COLUMN_MAP(CCustomerAccessor)
	COLUMN_ENTRY_STATUS(1, m_CustomerID, m_CustomerID_status)
	COLUMN_ENTRY(2, m_CustomerName)
	COLUMN_ENTRY_STATUS(3, m_Address, m_Address_status)
	COLUMN_ENTRY(4, m_SalesManID)
END_COLUMN_MAP()

DEFINE_COMMAND(CCustomerAccessor, _T("SELECT CustomerID, CustomerName, Address, SalesManID FROM Customer"))

	void ClearRecord()
	{
		memset(this, 0, sizeof(*this));
	}
};

//*************************************************************************************

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
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions