Results 1 to 2 of 2

Thread: Adodc refresh

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    8

    Unhappy

    I have two forms. In the 1st there is an adodc with recordsoruce for ex. = "Select * from costumers", this adodc is connected with a dbgrid (i tried with M$ dbgrid and Apex truedbgrid either), in that dbgrid you can't insert, update or delete. In the first form there is a command and, on the click event, i send to form 2 the selected row for update.
    In the secod form (form2) i open a recordset and i manage the record choosen in the form below (the DBMS is Access2000).
    In the second form when i have done my update, i refresh the 1st form's adodc (form1.adodc.refresh).
    If i perform that with big projects, sometimes doesn't work.
    The only way to reset all, is to exit from Vb and restart project.

    I have tried these codes in the second form: "form1.adodc.recordset.requery" or "Form1.refresh" or Form1.adodc.refresh" or form1.dbgrid.rebind" but the problem persists.

    Thanks for help

  2. #2
    Addicted Member P.S.W.'s Avatar
    Join Date
    Aug 2000
    Posts
    146
    I've also had problems refreshing the ADODC before, and my experience has been that using the ADODC.Refresh method is the wrong way to refresh a recordset. The .Refresh method only needs to be used if you change the .RecordSource or .ConnectionString property, for example. To refresh your recordset, you need to use the ADODC.Recordset.Requery method.

    Furthermore, I've found that if you place a .Refresh command immediately before a .Recordset.Requery command, it screws up the .Requery from working. So I do it like this:

    ADODC.Recordset.Delete (or Update, etc.)
    ADODC.Recordset.Requery

    If you're still having problems, a work-around you can use until you find a better solution is to force a rebuild of the recordset after the update:

    ADODC.Recordset.Update
    ADODC.RecordSource = "SELECT (repeat your orginal SQL here)"
    ADODC.Refresh

    Hope this helps!


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