Advertisement
Advertisement
| 08.26.2008 at 02:13AM PDT, ID: 23677806 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: |
try
{
ADODB::_RecordsetPtr records = GetRecordsByIndex();
_variant_t start = (long)ADODB::adBookmarkFirst;
_variant_t indexArray = records->GetRows(ADODB::adGetRowsRest, start, _bstr_t(_T("Index")));
long lUbound;
TESTHR(SafeArrayGetUBound(indexArray.parray, 2, &lUbound));
IndexList theIndexList;
for(int record=0; record<lUbound+1; ++record)
{
long rgIndices[2];
rgIndices[0] = 0;
rgIndices[1] = record;
_variant_t result;
result.vt = VT_I4;
TESTHR(SafeArrayGetElement(indexArray.parray, rgIndices, &result));
theIndexList.push_back((long)result.lVal); // This is where the error is reported
}
records->Close();
records = NULL;
return theIndexList;
}
catch(const _com_error& e)
{
if(HRESULT_CODE(e.Error()) == HRESULT_CODE(ADODB::adErrNoCurrentRecord))
{
// there are no records, so return an empty index list
return IndexList();
}
else
{
throw;
}
}
|