0
Answer

Using CADORecordBinding

Hoang Tran

Hoang Tran

16y
4.6k
1

Hello I am fresh in programming and VisualC++ is my first choice to learn and make software. I have problem with my application when I try to use CADORecordBinding. Here the code of the file DocGiaRs.h which cause error:

#pragma once

#define INITGUID

#import "..\msado15.dll" rename_namespace("ADOCG") rename("EOF","EndOfFile")

using namespace ADOCG

#include "icrsint.h"

class CADORecordBinding;

class CDocGiaRs:public CADORecordBinding

{

BEGIN_ADO_BINDING(CDocGiaRs)

ADO_VARIABLE_LENGTH_ENTRY2(1,adVarChar,m_strHoTen,sizeof(m_strHoTen),lHoTenStatus,TRUE)

ADO_VARIABLE_LENGTH_ENTRY2(2,adVarChar,m_strLoaiDocGia,sizeof(m_strLoaiDocGia,lLoaiDocGiaStatus,TRUE)

ADO_VARIABLE_LENGTH_ENTRY(3,adDate,m_dtNgaySinh,lNgaySinhStatus,TRUE)

ADO_VARIABLE_LENGTH_ENTRY2(4,adVarChar,m_strDiaChi,sizeof(m_strDiaChi),lDiaChiStatus,TRUE)

ADO_VARIABLE_LENGTH_ENTRY2(5,adVarChar,m_strEmail,sizeof(m_strEmail),lEmailStatus,TRUE)

ADO_VARIABLE_LENGTH_ENTRY(6,adDate,m_dtNgayLapThe,lNgayLapTheStatus,TRUE)

END_ADO_BINDING()

public:

CHAR m_strHoTen[256];

ULONG lHoTenStatus;

CHAR m_strLoaiDocGia[51];

ULONG lLoaiDocGiaStatus;

DATE m_dtNgaySinh;

ULONG lNgaySinhStatus;

CHAR m_strDiaChi[256];

ULONG lDiaChiStatus;

CHAR m_strEmail[256];

ULONG lEmailStatus;

DATE m_StrNgayLapThe;

ULONG lNgayLapTheStatus;

}

The errors are

Error 1 error C2144: syntax error : 'CADORecordBinding' should be preceded by ';' d:\program files\microsoft visual studio 8\vc\platformsdk\include\icrsint.h 19 
Error 2 fatal error C1057: unexpected end of file in macro expansion d:\documents and settings\suser\my documents\visual studio 2005\projects\quanlythuvien\quanlythuvien\docgiars.h 11 
Error 3 error C2144: syntax error : 'CADORecordBinding' should be preceded by ';' d:\program files\microsoft visual studio 8\vc\platformsdk\include\icrsint.h 19 
Error 4 fatal error C1057: unexpected end of file in macro expansion d:\documents and settings\suser\my documents\visual studio 2005\projects\quanlythuvien\quanlythuvien\docgiars.h 11 
I have read the book Sams Teach yourself Visual C++ in 21 days and I just try to type the same code as the lesson declare in Chapter 15. I don't know why it is error and hope you to say what is the error. Thank you very much.