ADO->Jet, seek method EOF, all subsequent setting the index fails
- From: Brett Morien <Brett Morien@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 22 Apr 2005 17:31:08 -0700
I'm using ADO in C++ to access a Jet 4.0 engine Access database. For
optimization reasons, we are leaving one main table open at all times, since
it needs to respond in real time, and opening/closing that table is very time
consuming.
If I set an index and call the seek method, and the result isn't found in
the table, the cursor is, rightly, placed at EOF. However, any attempts to
change the index of that table afterwards results in a DB_E_ROWSNOTRELEASED
error.
Is this a normal behavior?
Is there a way of resetting/releasing the rows after the bad seek?
Do I have any alternative other than to reset the connection to that table?
Some code:
// m_pRSAttrData is a _RecordsetPtr pointer to the always open table (table
direct)
try {
m_pRSAttrData->Index = _bstr_t(L"NameParentIndex");
hr = m_pRSAttrData->Seek(vKey, adSeekFirstEQ);
if (!m_pRSAttrData->EndOfFile)
nodeRes = ToNodeInfo(m_pRSAttrData->Fields);
m_pRSAttrData->Index = _bstr_t(L"PrimaryIndex"); // reset the index
} catch (_com_error& e)
{
// this is where it catches the DB_E_ROWSNOTRELEASED error any time this
code is called again after seek finds EOF
}
.
- Follow-Ups:
- Re: ADO->Jet, seek method EOF, all subsequent setting the index fails
- From: Stephen Howe
- Re: ADO->Jet, seek method EOF, all subsequent setting the index fails
- Prev by Date: Re: JRO replacement?
- Next by Date: Re: multiple DataReaders
- Previous by thread: RE: Migrating from Access to SQL Server 2000
- Next by thread: Re: ADO->Jet, seek method EOF, all subsequent setting the index fails
- Index(es):