C++ ADO MFC 连接数据库

来源:互联网 发布:linux下安装webpack 编辑:程序博客网 时间:2024/06/05 06:02

在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;        }

这些代码 然后再连接。。。。

0 0
原创粉丝点击