CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 1999
    Posts
    143

    Requery not working for me

    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);
    }







  2. #2
    Join Date
    Sep 1999
    Location
    Europe / Austria / Innsbruck
    Posts
    442

    Re: Requery not working for me

    Hi, use MoveFirst to go to the first record.


  3. #3
    Join Date
    Jun 1999
    Posts
    143

    Re: Requery not working for me

    That didn't help either....same message.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured