VS2012
1、初始化ADO
//hpp头文件里导入ADO //导入ADO动态链接库 #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "adoEOF") //cpp文件OnInitDialog()里初始化ADO //初始化ADO HRESULT hr; try { hr = CoInitialize(NULL); //检查初始化是否成功 if (SUCCEEDED(hr)) { AfxMessageBox("初始化ADO COM成功!"); } else { AfxMessageBox("初始化ADO COM失败!"); } } catch (_com_error e) { CString errormessage; errormessage.Format("%s"), e.ErrorMessage(); AfxMessageBox(errormessage); }