VC显示错误C2065为什么?

zjs_sql 2006-09-30 05:09:07
源代码
==============================================
void CNewadoDlg::OnButton1()
{
// TODO: Add your control notification handler code here
_ConnectionPtr m_conn;
_RecordsetPtr m_rs;
m_conn.CreateInstance(__uuidof(Connection));
m_rs.CreateInstance(__uuidof(Recordset));
try
{m_conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Home.mdb","","",adModeUnknown); }
catch(_com_error e)
{AfxMessageBox("数据库连接失败,确认数据库home.mdb是否在当前路径下!");}
CString sqlexec;
sqlexec="select * from Budget";
m_rs->Open(sqlexec.AllocSysString(),m_conn.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText);

//AfxMessageBox("打开记录成功");
m_list1.DeleteAllItems();
int i=-1;
AfxMessageBox(_bstr_t(m_rs->GetCollect("type")));
while(!m_rs->adoEOF())
{
m_rs->MoveNext();
}




// 如Connection对象是打开的则关闭它
m_rs->Close();
if(m_conn->GetState()==adStateOpen) m_conn->Close();
m_conn.Release(); // 释放Connection对象


}
======================================
错误:
--------------------Configuration: newado - Win32 Debug--------------------
Compiling...
newadoDlg.cpp
D:\VC\数据库\newado\newadoDlg.cpp(229) : error C2064: term does not evaluate to a function
D:\VC\数据库\newado\newadoDlg.cpp(229) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.

newado.exe - 2 error(s), 0 warning(s)
...全文
518 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
DentistryDoctor 2006-09-30
  • 打赏
  • 举报
回复
Compiler Error C2064

Language Filter: All Language Filter: Multiple Language Filter: Visual Basic Language Filter: C# Language Filter: C++ Language Filter: J# Language Filter: JScript
Visual Basic (Declaration)
Visual Basic (Usage)
C#
C++
J#
JScript

Error Message
term does not evaluate to a function taking 'number' arguments


A call is made to a function through an expression. The expression does not evaluate to a function pointer.

The following sample generates C2064:

Copy Code
// C2064.cpp
int i, j;
char* p;
void func() {
j = i(); // C2064, i is not a function
p(); // C2064, p doesn't point to a function
}


The following sample generates C2064:

Copy Code
// C2064b.cpp
struct C {
void func1(){}
void func2(){}
};

typedef void (C::*pFunc)();

int main() {
C c;
pFunc funcArray[2] = {&C::func1, &C::func2};
(funcArray[0])(); // C2064
}


adoEOF不是方法吧?

折腾_苏州 2006-09-30
  • 打赏
  • 举报
回复
你的229哪一行? 初看没大问题.

注意::CoInitialize(NULL);初始化 和
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")

m_rs->adoEOF() => m_rs->EndOfFile

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧