我有同样的问题,当我开始使用ADO。 (红色下划线,找不到...) 它驱使我坚果,但在编译后,下划线消失了,一切正常。我使用 #import "C:\Program\Delade filer\System\ado\msado15.dll" rename_namespace("USEADO"),rename("EOF","EndOfFile")
在我的头。
在CPP例如:
#include "stdafx.h"
int SQLsetInfo(THING *Thing, GADGET *Gadget)
{
HRESULT hr;
USEADO::_ConnectionPtr connection;
USEADO::_RecordsetPtr recordset;
//Initialize COM
if(FAILED(hr = CoInitialize(NULL)))
{ MessageBox(NULL, L"Initialize COM Failed", L"MyProg!",MB_ICONEXCLAMATION |MB_OK);
//Do something, eg shut down DB stuff and continue without or exit program
//Insert error handeler below
return hr;//TODO Ad error handeling see line 149
}
if(FAILED(hr = connection.CreateInstance(__uuidof(USEADO::Connection))))
{ MessageBox(NULL, L"Create connection instance Failed", L"MyProg!",MB_ICONEXCLAMATION |MB_OK);
//Do something, eg shut down DB stuff and continue without or exit program
return hr;
}
if(FAILED(hr = recordset.CreateInstance(__uuidof(USEADO::Recordset))))
{ MessageBox(NULL, L"Create recordset instance Failed", L"MyProg!",MB_ICONEXCLAMATION |MB_OK);
//Do something, eg shut down DB stuff and continue without or exit program
return hr;
}
connection->CursorLocation = USEADO::adUseServer; //http://dev.mysql.com/tech-resources/articles/vb-cursors-and-locks.html
//Try to connect to SQL server
try { connection->Open(L"YOUR CONNECTION STRING", USEADO::adConnectUnspecified); }
catch(...) {std::cout << "!!! connection->Open(ConnectionString FAILED !!!" << std::endl; }
我不在C++方面的专家,但是这个工作正常,我。希望它可以帮助你。如果任何人在这里有建议/评论家上面的代码中,我期待着它....
是您的机器32位或64位?如果64位,你需要指向程序文件(x86) – crashmstr
请参阅以下内容:https://stackoverflow.com/questions/42036189/msado15-tlh-not-generated-after-importing-msado15-dll/46540869#46540869 – Kamleshwar
请参考以下内容:https://stackoverflow.com/questions/42036189/msado15-tlh-not-generated-after-importing-msado15-dll/46540869#46540869 – Kamleshwar