ADO Recordset object returning 80004003 Error

▼魔方 西西 提交于 2019-12-08 04:32:19

问题


I am simply trying to Open a Recordset, but it is returning me error..

Here is a part of my code:

void MyFunction(_ConnectionPtr ConnPtr) {
    _RecordsetPtr RecPtr;
    std::string command = "Select * from MYTABLE";

    RecPtr.CreateInstance(__uuidof(_Recordset));
    RecPtr->Open(command.c_str(), ConnPtr.GetInterfacePtr(), adOpenStatic, adLockOptimistic, adCmdText);              
    //ERROR!!!!!!!
}


int main(int argc, char** argv) {
    CoInitializeEx(NULL, COINIT_MULTITHREADED)

    _ConnectionPtr ConnPtr;
    ConnPtr.CreateInstance("ADODB.Connection");
    ConnPtr->Open(....my Connection String, UserID, and Password....);

    MyFunction(ConnPtr);

    ::CoUninitialize();
    ConnPtr->Close();
}


The Error Message:

Code = 80004003
Code Meaning = I
Source = <null>
Description = <null>
dd

(The description says nothing.. and also I have no idea what "I" means or why "dd" is printed out at the end,,)


There is nothing wrong with the connection string, userID, and Password, since opening the connection ptr returns no error. The error occurs when I try to open the Recordset.. Can anyone find a problem in my code?

Thanks

来源:https://stackoverflow.com/questions/24512142/ado-recordset-object-returning-80004003-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!