在stdafx.h 导入
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
然后在主窗口cpp里插入:
BOOL CSportMangeApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
//初始化OLE DLLs
if(!AfxOleInit())
{
AfxMessageBox("初始化OLE DLL失败!");
return FALSE;
}
这些代码 然后再连接。。。。