HI all,
In the small Application what I am developing, I am estabilishing a OLE DB connection to acces the data base
It is very big query which is being fired and I always get “Timeout Expired” error at the catch statement
Following is the code what I use
the database connection is established using the following lines of codeCode:try { HRESULT hResult; hResult = m_pRecordset.CreateInstance(__uuidof(ADODB::Recordset)); if (FAILED(hResult)) { throw _com_error(hResult); } else { m_pPIConnection->CursorLocation = ADODB::adUseClient; _variant_t varQuery; varQuery = cStrSQLQuery.AllocSysString(); hResult = m_pRecordset->Open(varQuery,m_pPIConnection.GetInterfacePtr(),ADODB::adOpenForwardOnly, ADODB::adLockReadOnly,ADODB::adCmdText); if (FAILED(hResult)) { throw _com_error(hResult); } else { // process the data } } catch(_com_error &e) { nStatusFlag = N_FAILED; BSTR bStrErrorDesc; bStrErrorDesc = (BSTR)e.Description(); CString cStrErrorDesc(bStrErrorDesc); gcIntfMessage.AddMessage(STR_PI_ERROR_CODE_1006 + STR_SEMICOLON + cStrErrorDesc); } catch(...) { nStatusFlag = N_FAILED; AfxMessageBox(_T("Unhandlled exception")); };
I tried adjusting the “Connect Timeout” property in the above connect string …. But still I Get the sameCode:cStrConnectionString.Format(_T("Provider=PIOLEDB;Data Source=%s;Initial Catalog=PIARCHIVE;Connect Timeout=100;User Id=%s;Password=%s;"),m_sProsPIServer.cStrDSN,m_sProsPIServer.cStrUserName,m_sProsPIServer.cStrPassword); _bstr_t bStrConnectionString = cStrConnectionString; hr = m_pPIConnection->Open(bStrConnectionString, L"",L"", ADODB::adConnectUnspecified); if (SUCCEEDED(hr)) { bConnectionStatus = TRUE; }
Error can some one help me to get trough?
Thanks and Regards
RK




Reply With Quote