ADO wrapper
/********************************************************************
Created: 2007/03/30
Created: 30:3:2007 13:06
Author: 刘胤
Purpose: wrapper for _Recordset
*********************************************************************/
#ifndef AdoRecordSet_H
#define AdoRecordSet_H
#include <AfxDisp.h>
#include <icrsint.h>
#pragma warning(disable:4146)
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "adoEOF"), rename("BOF", "adoBOF")
#pragma warning(default:4146)
namespace AdoUtility
{
class CAdoConnection;
class CAdoRecordSet
{
public:
CAdoRecordSet(BOOL bInit = TRUE);
~CAdoRecordSet();
void Attach(_Recordset *pRecordset);
_Recordset * Detach();
BOOL SetIndex(const CString &strIndex) const;
BOOL GetIndex(CString &strIndex) const;
BOOL Resync(AffectEnum AffectRecords, ResyncEnum ResyncValues) const;
BOOL GetDataMember(CString &strDataMember) const;
BOOL SetDataMember(const CString &strDataMember) const;
BOOL SetStayInSync(BOOL bStayInSync) const;
BOOL GetStayInSync(BOOL &bStayInSync) const;
BOOL GetActiveCommand(IDispatch **ppCmd) const;
BOOL Find(const CString &strFind, long nSkipRecords, SearchDirectionEnum nSearchDirection) const;
BOOL GetMarshalOptions(MarshalOptionsEnum &nMarshalOptions) const;
BOOL SetMarshalOptions(MarshalOptionsEnum nMarshalOptions) const;
BOOL GetSupports(CursorOptionEnum CursorOptions, VARIANT_BOOL &bSupports) const;
BOOL UpdateBatch(AffectEnum AffectRecords) const;
BOOL CancelBatch(AffectEnum AffectRecords) const;
CAdoRecordSet * Clone(LockTypeEnum nLockType) const;
CAdoRecordSet * xClone() const;
BOOL GetPageSize(long &nPageSize) const;
BOOL SetPageSize(long nPageSize) const;
BOOL GetSort(CString &strSort) const;
BOOL SetSort(const CString &strSort) const;
BOOL GetPageCount(long &nPageCount) const;
BOOL xResync(AffectEnum AffectRecords) const;
BOOL Requery(long nOptions) const;
BOOL GetAbsolutePage(PositionEnum &nPosition) const;
BOOL SetAbsolutePage(PositionEnum nPosition) const;
BOOL SetSource(const CString &strSource) const;
BOOL GetSource(CString &strSource) const;
BOOL GetLockType(LockTypeEnum &nLockType) const;
BOOL SetLockType(LockTypeEnum nLockType) const;
BOOL GetCacheSize(long &nCacheSize) const;
BOOL SetCacheSize(long nCacheSize) const;
BOOL GetBookmark(BookmarkEnum &bookmark) const;
BOOL SetBookmark(BookmarkEnum bookmark = adBookmarkFirst) const;
BOOL SetAbsolutePosition(PositionEnum nPosition) const;
BOOL GetAbsolutePosition(PositionEnum &nPosition) const;
BOOL GetCursorLocation(CursorLocationEnum &nCursorLocation) const;
BOOL SetCursorLocation(CursorLocationEnum nCursorLocation = adUseClient) const;
BOOL GetCursorType(CursorTypeEnum &nCursorType) const;
BOOL SetCursorType(CursorTypeEnum nCursorType = adOpenStatic) const;
BOOL GetState(long &nState) const;
BOOL GetStatus(long &nStatus) const;
BOOL GetFieldAttributes(long nIndex, long &nAttributes) const;
BOOL GetFieldAttributes(LPCTSTR pszFieldName, long &nAttributes) const;
BOOL GetFieldType(long nIndex, DataTypeEnum &nDataType) const;
BOOL GetFieldType(LPCTSTR pszFieldName, DataTypeEnum &nDataType) const;
CAdoConnection * GetConnection() const;
BOOL SetAdoConnection(CAdoConnection * const pConnection) const;
BOOL GetEditMode(EditModeEnum &nEditMode) const;
BOOL Open(const CString &strSQL, long nOption = adCmdText, CursorTypeEnum nCursorType = adOpenStatic, LockTypeEnum nLockType = adLockOptimistic) const;
BOOL Cancel() const;
BOOL Close() const;
BOOL IsOpen() const;
BOOL IsBOF(BOOL &bBOF) const;
BOOL IsEOF(BOOL &bEOF) const;
BOOL GetRecordCount(long &nRecordCount) const;
BOOL GetFieldsCount(long &nFieldsCount) const;
BOOL GetMaxRecordCount(long &nMaxRecordCount) const;
BOOL SetMaxRecordCount(long nMaxRecordCount) const;
BOOL MoveFirst() const;
BOOL MoveNext() const;
BOOL MovePrevious() const;
BOOL MoveLast() const;
BOOL Move(long nRecords, const CComVariant &varStartPos = CComVariant((long) adBookmarkFirst)) const;
BOOL GetFieldName(long nIndex, CString &strFieldName) const;
public:
BOOL AddNew() const;
BOOL Update() const;
BOOL CancelUpdate() const;
BOOL Delete(AffectEnum AffectRecords = adAffectCurrent) const;
BOOL GetCollect(long nIndex, bool &bValue) const;
BOOL GetCollect(long nIndex, CString &strValue) const;
BOOL GetCollect(long nIndex, double &dValue) const;
BOOL GetCollect(long nIndex, float &dValue) const;
BOOL GetCollect(long nIndex, long &nValue) const;
BOOL GetCollect(long nIndex, DWORD &dwValue) const;
BOOL GetCollect(long nIndex, int &nValue) const;
BOOL GetCollect(long nIndex, short &nValue) const;
BOOL GetCollect(long nIndex, BYTE &nValue) const;
BOOL GetCollect(long nIndex, COleDateTime &oleValue) const;
BOOL GetCollect(long nIndex, COleCurrency &oleValue) const;
BOOL GetCollect(LPCSTR pszFieldName, bool &bValue) const;
BOOL GetCollect(LPCSTR pszFieldName, CString &strValue) const;
BOOL GetCollect(LPCSTR pszFieldName, double &dValue) const;
BOOL GetCollect(LPCSTR pszFieldName, float &dValue) const;
BOOL GetCollect(LPCSTR pszFieldName, long &nValue) const;
BOOL GetCollect(LPCSTR pszFieldName, DWORD &dwValue) const;
BOOL GetCollect(LPCSTR pszFieldName, int &nValue) const;
BOOL GetCollect(LPCSTR pszFieldName, short &nValue) const;
BOOL GetCollect(LPCSTR pszFieldName, BYTE &nValue) const;
BOOL GetCollect(LPCSTR pszFieldName, COleDateTime &value) const;
BOOL GetCollect(LPCSTR pszFieldName, COleCurrency &value) const;
public:
BOOL PutCollect(long nIndex, LPCTSTR pszValue) const;
BOOL PutCollect(long nIndex, const double &dValue) const;
BOOL PutCollect(long nIndex, const float &dValue) const;
BOOL PutCollect(long nIndex, long nValue) const;
BOOL PutCollect(long nIndex, DWORD nValue) const;
BOOL PutCollect(long nIndex, int nValue) const;
BOOL PutCollect(long nIndex, short nValue) const;
BOOL PutCollect(long nIndex, BYTE nValue) const;
BOOL PutCollect(long nIndex, bool bValue) const;
BOOL PutCollect(long nIndex, const COleDateTime &oleValue) const;
BOOL PutCollect(long nIndex, const COleCurrency &oleValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, LPCTSTR pszValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, const double &dValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, const float &dValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, long nValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, DWORD nValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, int nValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, short nValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, BYTE nValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, bool bValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, const COleDateTime &oleValue) const;
BOOL PutCollect(LPCTSTR pszFieldName, const COleCurrency &oleValue) const;
...全文
相关推荐
ADO Wrapper ClassesADO包装类
在“ADO Wrapper Classes”中,我们可以预期包含以下几个关键知识点:1.
ado-class.zip_ADO CLASS_ADO wrapper_ado+mysql_c++ ado sqlserver_
标题中的"ado-class.zip_ADO CLASS_ADO wrapper_ado+mysql_c++ ado sqlserver_"表明这是一个关于ADO封装类的项目,这个类库可能是用C++编写的
ADO C++封装类
"); ``` - 调用执行SQL命令: ```cpp wrapper.ExecuteCommand("SELECT * FROM MyTable WHERE ID = 1"); ADO::RecordsetPtr
一组ADO的MFC包装器类-版本2.20J
"A-Set-of-MFC-Wrapper-Classes-for-ADO-Version-J.pdf" 可能是关于这个版本2.20J MFC包装器类的详细文档,里面应该包含类库的使用方法、API接口介绍以及示例代码
ado.h ado.cpp
下面将详细讨论这两个文件以及ADO在数据库编程中的应用。首先,"ado.h"是一个头文件,通常包含ADO库中的定义和声明,它为C++程序提供了访问ADO对象的接口。


数据库
