Click to See Complete Forum and Search --> : Requery not working for me


sqrly
October 21st, 1999, 08:39 AM
I have a db app up and working. Appwizard generated a toolbar that has arrows that steps through the records. This all works.

I also have a second thread that is doing inserts to the database independent of my interface thread. The problem is that the new records added after that app started are not in the recordset. The docs say use requery. When I call requery() when one of the buttons is pushed it breaks the recordset. ODBC returns the error:

"Field can't be updated. No rows updated or deleted"

It is an access db. After that the buttons don't work at all. They return this error message:

"Invalid cursor position; no keyset defined"

Any ideas how I do this properly?

Here is my call that breaks everything:

void CMySampleView::OnRecordFirst()
{
if (m_pSet->CanRestart())
{
if (!m_pSet->Requery())
AfxMessageBox("Error: requery failed");
}
else
AfxMessageBox("Cannot restart");
OnMove(ID_RECORD_FIRST);
}

Thomas Ascher
October 25th, 1999, 09:52 AM
Hi, use MoveFirst to go to the first record.

sqrly
October 25th, 1999, 12:44 PM
That didn't help either....same message.