IRowsetFind

From: mxc <mxc_at_freemail.absa.co.za>
Date: Sun, 26 Aug 2001 20:11:28 -0700
Message-ID: <3b8911c3_1_at_batman.vip-za.com>


Hi there,

Anyone here got experience with the IRowsetFind interface and Oracle8? I need some code samples to find out why my code keeps on failing. My code is below. It is in C++ using Visual C++ 6. Note m_CostCentre is has been assigned to hAccessor and it works fine for retrtieving the data. If I use DBCOMPAREOPS_EQ in the FindNextRow method I get OEF/BOF all the time even when I know that there is a CostCentreKey with a value of 1. I only get results if the copmarison is set to DBCOMPAREOPS_GE.

I am using the folling class to create the oledb com object. (FAIL)(CLOSE) are simple macros.

Please help

kind regards
Mark

hr = CLSIDFromProgID(L"OraOLEDB.Oracle.1",&OracleCLSID);  FAIL(hr,"Could not get CLSID for Oracle in class CDataSource")  hr = CoCreateInstance
(OracleCLSID,NULL,CLSCTX_INPROC_SERVER,IID_IDBInitialize,(void**)&pDBInit);  FAIL(hr,"Could not create instance of Oracle OLEDB provider in class CDataSource")

 if (pRowSet == NULL)
 {
  if (!InitialiseCostCentreRS()) return false;  };

 try
 {

//***************************
//***************************
//Variables
//***************************
//***************************

 const int No_Params =1;
 IRowsetFind *pRowSetFind=NULL;
 HRESULT hr=0;
 OLECHAR * pKey=NULL;
 ULONG RowsFound=0;
 HROW Rows[10];
 HROW* pRows=Rows;
 OLECHAR *pStr=NULL;
 HACCESSOR hAccessor1;
 IAccessor* pAccessor=NULL;
 DBBINDING ParamBindings[No_Params];
 DBBINDSTATUS *Status = new DBBINDSTATUS [No_Params];

 ZeroMemory ((void*)Status,sizeof(DBBINDSTATUS));  ZeroMemory ((void*)ParamBindings,sizeof(ParamBindings));

 int j=10;

  ParamBindings[0].eParamIO=DBPARAMIO_INPUT;
  ParamBindings[0].dwMemOwner=DBMEMOWNER_CLIENTOWNED;
  ParamBindings[0].obLength=NULL;
  ParamBindings[0].bPrecision=0;
  ParamBindings[0].bScale=0;
  ParamBindings[0].cbMaxLen=sizeof(j);
  ParamBindings[0].dwFlags=NULL;
  ParamBindings[0].dwPart=DBPART_VALUE;
  ParamBindings[0].iOrdinal=1;
  ParamBindings[0].obStatus=NULL;
  ParamBindings[0].obValue=0;
  ParamBindings[0].wType=DBTYPE_I4;

 hr = pRowSet->QueryInterface(IID_IAccessor,(void**)&pAccessor);  FAIL (hr,"Could not get accessor interface for FindRow in CCostCentres")  hr =
pAccessor->CreateAccessor(DBACCESSOR_ROWDATA,No_Params,&ParamBindings[0],siz eof(j),&hAccessor1,Status);
 FAIL (hr,"Could not create accessor for FindRow in CCostCentres")  hr = pRowSet->QueryInterface(IID_IRowsetFind,(void**)&pRowSetFind);  FAIL(hr,"Could not get IRowsetFind interface in CCostCentres")
//ConvertStringToWCS (Key,pStr);

 hr =
pRowSetFind->FindNextRow(DB_NULL_HCHAPTER,hAccessor1,&j,DBCOMPAREOPS_EQ,0,

        NULL,0,10,&RowsFound,&pRows);
  FAIL(hr,"Could not FindNextRow succesfully")  if (hr==265926) AfxMessageBox ("EOF,BOF",MB_OK);  CLOSE (pAccessor)
 CLOSE (pRowSetFind)
 delete [] Status;
 Status=NULL;
 ZeroMemory ((void*)&m_CostCentre,sizeof(m_CostCentre));  for (int m=0;m<RowsFound;m++) {

         pRowSet->GetData(Rows[m],hAccessor,(void*)&m_CostCentre);
         }

 } Received on Mon Aug 27 2001 - 05:11:28 CEST

Original text of this message