请教大家一个小问题,在线等待,解决就结。

时间:2022-03-09 18:48:16
用_RecordsetPtr时。在MISApp中定义了一个_RecordsetPtr m_pADOSet;和
bool CMISApp::ADOExecute(_RecordsetPtr &ADOSet, _variant_t &strSQL)
为什么出现了syntax error : identifier '_RecordsetPtr'错误。
error C2065: '_RecordsetPtr' : undeclared identifier
error C2065: 'ADOSet' : undeclared identifier
如何解决。
 我在stdafx.h中已引入了#import "C:\program files\common files\System\ado\msado15.dll" no_namespace \
rename("EOF","EndOfFile") \

谢谢了。

7 个解决方案

#1


#include <afxole.h>

#2


#import "C:\program files\common files\System\ado\msado15.dll" no_namespace rename("EOF","EndOfFile")

要添加在stdafx.h中原有的所有的#include<...>之后

#3


#include "afxole.h"
##import这段话放在你的cpp文件的前面比在stdafx当中好

#4


不过#include "afxole.h"
还是比较方便

#5


还是不行呀。帮我想想办法呀,着急呀。

#6


bool CMISApp::ADOExecute(_RecordsetPtr &ADOSet, _variant_t &strSQL)

改成
bool CMISApp::ADOExecute(_RecordsetPtr ADOSet, _variant_t &strSQL)

别用引用传递参数,这样也可以达到你的要求

#7


谢谢大家了, 不过还是不行呀,
其实我想问大家的是在程序里只定义_RecordsetPtr m_pADOSet;
也出错,syntax error : identifier '_RecordsetPtr'错误
我在stdafx.h中已引入了#import "C:\program files\common files\System\ado\msado15.dll" no_namespace rename("EOF","EndOfFile") \的前提下。哎。

#1


#include <afxole.h>

#2


#import "C:\program files\common files\System\ado\msado15.dll" no_namespace rename("EOF","EndOfFile")

要添加在stdafx.h中原有的所有的#include<...>之后

#3


#include "afxole.h"
##import这段话放在你的cpp文件的前面比在stdafx当中好

#4


不过#include "afxole.h"
还是比较方便

#5


还是不行呀。帮我想想办法呀,着急呀。

#6


bool CMISApp::ADOExecute(_RecordsetPtr &ADOSet, _variant_t &strSQL)

改成
bool CMISApp::ADOExecute(_RecordsetPtr ADOSet, _variant_t &strSQL)

别用引用传递参数,这样也可以达到你的要求

#7


谢谢大家了, 不过还是不行呀,
其实我想问大家的是在程序里只定义_RecordsetPtr m_pADOSet;
也出错,syntax error : identifier '_RecordsetPtr'错误
我在stdafx.h中已引入了#import "C:\program files\common files\System\ado\msado15.dll" no_namespace rename("EOF","EndOfFile") \的前提下。哎。