XiaoHui.Net 笑汇程序员论坛Visual C++ 讨论区

   如何在一个新建的MFC基于对话框的 Dlg上实现连接ODBC


页: [1]

ceryxu2007-3-20 02:51
如何在一个新建的MFC基于对话框的 Dlg上实现连接ODBC

我想用VC++6 做一个小词典
就是用一个DLG连上词典的ACCESS库
我试过建立一个'CRecordset' 类连我的ODBC,一运行,就出现了如下错误,请高手指点一二!!
万谢!!
/*//////////////////////////////////////cetset就是我新建的'CRecordset'
cetset.h(14) : error C2504: 'CRecordset' : base class undefined
cetset.h(16) : error C2629: unexpected 'class cet ('
cetset.h(16) : error C2238: unexpected token(s) preceding ';'
cetset.h(33) : error C2061: syntax error : identifier 'CFieldExchange'
cetset.cpp(17) : error C2653: 'CRecordset' : is not a class or namespace name
cetset.cpp(17) : error C2065: 'classCRecordset' : undeclared identifier
cetset.cpp(19) : error C2065: 'CDatabase' : undeclared identifier
cetset.cpp(19) : error C2065: 'pdb' : undeclared identifier
cetset.cpp(20) : error C2448: '<Unknown>' : function-style initializer appears to be a                 function definition
cetset.cpp(20) : error C2143: syntax error : missing ';' before ':'
cetset.cpp(21) : error C2448: '<Unknown>' : function-style initializer appears to be a                 function definition
cetset.cpp(42) : error C2065: 'CFieldExchange' : undeclared identifier
cetset.cpp(42) : error C2065: 'pFX' : undeclared identifier
cetset.cpp(43) : error C2448: '<Unknown>' : function-style initializer appears to be a                 function definition
cetset.cpp(58) : error C2653: 'CRecordset' : is not a class or namespace name
cetset.cpp(63) : error C2653: 'CRecordset' : is not a class or namespace name
*////////////////////////////////////


帆船2007-5-16 06:35
首先,不应该用CRecordSet类去连接数据源,在以前的版本中他是一个抽象类,不能创建对象。
然后,应该向应用程序添加ODBC使用者,利用向导生成的记录集类去连接数据源


查看完整版本: 如何在一个新建的MFC基于对话框的 Dlg上实现连接ODBC