I followed the instructions for creating an ADO based program from the book Teaching Yourself Visual C++ in 21 days...
Here's the code I have a problem with:
// MyRecordset.h: interface for the CMyRecordset class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_)
#define AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define INITGUID
#include "icrsint.h"
#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
rename_namespace("ADOCG" rename("EOF", "EndOfFile"
using namespace ADOCG;
class CMyRecordset : public CADORecordBinding
{
BEGIN_ADO_BINDING(CMyRecordset)
ADO_FIXED_LENGTH_ENTRY(1,adInteger, m_lAddressID, lAddressIDStatus, FALSE)
ADO_FIXED_LENGTH_ENTRY2(2, adVarChar, m_szFirstName, sizeof(m_szFirstName),
lFirstNameStatus, TRUE)
ADO_FIXED_LENGTH_ENTRY2(3, adVarChar, m_szLastName, sizeof(m_szLastName),
lLastNameStatus, TRUE)
ADO_FIXED_LENGTH_ENTRY2(4, adVarChar, m_szSpouseName, sizeof(m_szSpouseName),
lSpouseNameStatus, TRUE)
END_ADO_BINDING()
public:
LONG m_lAddressID;
ULONG lAddressIDStatus;
LONG m_szFirstName;
ULONG lFirstNameStatus;
LONG m_szLastName;
ULONG lLastNameStatus;
LONG m_szSpouseName;
ULONG lSpouseNameStatus;
};
#endif // !defined(AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_)
When I comple the program I get numerous erros starting with the followign:
Compiling...
MyRecordset.cpp
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(906) : error C2504: 'Connection15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1074) : error C2504: 'Recordset20' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1108) : error C2504: 'Recordset15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1236) : error C2629: unexpected 'short ('
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1236) : error C2238: unexpected token(s) preceding ';'
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1494) : error C2504: 'Fields15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(293) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Connection *const ' to 'struct IUnknown *'
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(481) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(487) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'
...
I assume the first 3 or 4 erros are related to the remaining erros. Can anyone point me in the right direction. I can't seem to find a lot of info in any of the reference materials I have about ADO??!!
Here's the code I have a problem with:
// MyRecordset.h: interface for the CMyRecordset class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_)
#define AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define INITGUID
#include "icrsint.h"
#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
rename_namespace("ADOCG" rename("EOF", "EndOfFile"
using namespace ADOCG;
class CMyRecordset : public CADORecordBinding
{
BEGIN_ADO_BINDING(CMyRecordset)
ADO_FIXED_LENGTH_ENTRY(1,adInteger, m_lAddressID, lAddressIDStatus, FALSE)
ADO_FIXED_LENGTH_ENTRY2(2, adVarChar, m_szFirstName, sizeof(m_szFirstName),
lFirstNameStatus, TRUE)
ADO_FIXED_LENGTH_ENTRY2(3, adVarChar, m_szLastName, sizeof(m_szLastName),
lLastNameStatus, TRUE)
ADO_FIXED_LENGTH_ENTRY2(4, adVarChar, m_szSpouseName, sizeof(m_szSpouseName),
lSpouseNameStatus, TRUE)
END_ADO_BINDING()
public:
LONG m_lAddressID;
ULONG lAddressIDStatus;
LONG m_szFirstName;
ULONG lFirstNameStatus;
LONG m_szLastName;
ULONG lLastNameStatus;
LONG m_szSpouseName;
ULONG lSpouseNameStatus;
};
#endif // !defined(AFX_MYRECORDSET_H__72E24534_2F57_11D6_B03F_0040F6B4AC3D__INCLUDED_)
When I comple the program I get numerous erros starting with the followign:
Compiling...
MyRecordset.cpp
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(906) : error C2504: 'Connection15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1074) : error C2504: 'Recordset20' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1108) : error C2504: 'Recordset15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1236) : error C2629: unexpected 'short ('
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1236) : error C2238: unexpected token(s) preceding ';'
F:\Mike\AMS_XP\DbAdo\Debug\msado15.tlh(1494) : error C2504: 'Fields15' : base class undefined
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(293) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Connection *const ' to 'struct IUnknown *'
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(481) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'
F:\Mike\AMS_XP\DbAdo\Debug/msado15.tli(487) : error C2664: '_com_issue_errorex' : cannot convert parameter 2 from 'struct ADODB::_Recordset *const ' to 'struct IUnknown *'
...
I assume the first 3 or 4 erros are related to the remaining erros. Can anyone point me in the right direction. I can't seem to find a lot of info in any of the reference materials I have about ADO??!!