天天看點

VC 使用ADO連接配接資料庫的問題!error C2059: 文法錯誤 : “<L_TYPE_raw>”

 在stafx.h中添加

#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace 

rename("EOF", "adoEOF")

錯誤提示:

1>d:\documents\codes\ch15demo1\ch15demo1\debug\msado15.tlh(2373) : error C2059: 文法錯誤 : “<L_TYPE_raw>”

1>d:\documents\codes\ch15demo1\ch15demo1\debug\msado15.tlh(2373) : error C2238: 意外的标記位于“;”之前

1>d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>

解決辦法如下:

#import "c:\program files\common files\system\ado\msado15.dll" named_guids rename_namespace("ADOCG") rename("EOF", "EndOfFile") rename("BOF","FirstOfFile")

using namespace ADOCG;

添加到stafx.h的最後面