[Oledb-dev] Invalid

Debjit Kar debjitk at hotmail.com
Mon May 14 17:33:54 UTC 2007


Hello,I am always getting an "Invalid parameter" error. I have tried different combinations. With all output parameters, with no parameters (error unspecified), with one input parameter with all input parameters. I still could'nt figure out whats is the exact problem.    HRESULT hr = S_OK;    _ConnectionPtr m_spConn = NULL;    _CommandPtr m_spCmd = NULL;    _ParameterPtr pprm_Param1 = NULL;    _ParameterPtr pprm_Param2 = NULL;    hr = CoCreateInstance(__uuidof(ADODB::Connection), NULL, CLSCTX_INPROC_SERVER, __uuidof(ADODB::_Connection), reinterpret_cast<void**>(&m_spConn));    if(FAILED(hr))        return hr;    // initialize command object    hr = CoCreateInstance(__uuidof(ADODB::Command), NULL, CLSCTX_INPROC_SERVER, __uuidof(ADODB::_Command), reinterpret_cast<void**>(&m_spCmd));    if(FAILED(hr))        return hr;    hr = m_spConn->put_CursorLocation(adUseServer);    if(FAILED(hr))        return hr;    hr = m_spConn->put_Mode(adModeReadWrite);    if(FAILED(hr))        return hr;    hr = m_spConn->Open(L"Provider=PostgreSQL OLE DB Provider;Data Source=192.168.1.2;Location=testdb;User ID=postgres;Password=test;", L"", L"", adConnectUnspecified);    if(FAILED(hr))        return hr;    hr = m_spCmd->put_CommandType(adCmdStoredProc);    if(FAILED(hr))        return hr;    hr = m_spCmd->put_CommandText(SysAllocString(L"uob.usp_test_003"));    if(FAILED(hr))        return hr;    hr = m_spCmd->putref_ActiveConnection(m_spConn);    if(FAILED(hr))        return hr;    // command parameters    hr = m_spCmd->raw_CreateParameter(L"param1", adInteger, adParamOutput, 4, vtMissing, pprm_Param1.operator &());    if(FAILED(hr))        return hr;    pprm_Param1->Precision = (unsigned char)10;    pprm_Param1->NumericScale = (unsigned char)0;    // add command parameters    hr = m_spCmd->Parameters->Append(pprm_Param1);    if(FAILED(hr))        return hr;    //execute command    hr = m_spCmd->raw_Execute(NULL, NULL, adExecuteNoRecords, NULL);    if(FAILED(hr))        return hr;    hr = m_spConn->Close();    if(FAILED(hr))        return hr;    m_spCmd = NULL;    m_spConn = NULL;    return S_OK;I don't know what is the problem. Can somebody on this earth tell me what is wrong. Oh yes PgOleDb throws error when i call Parameters->Refresh();Regards,Debjit Kar
_________________________________________________________________
Create the ultimate e-mail address book. Import your contacts to Windows Live Hotmail.
www.windowslive-hotmail.com/learnmore/managemail2.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_impcont_0507
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/oledb-devel/attachments/20070514/682cb446/attachment.html 


More information about the Oledb-devel mailing list