Results 1 to 4 of 4

Thread: ADO Refresh

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    ADO Refresh

    I have a main form, from which I open a another form, frmSchedule
    frmSchedule has a datagrid, which is bound to an ado data control
    The data control is based on a table called TempSchedule. Before I open frmSchedule, I delete the contents of TempSchedule and replace with a fresh schedule.
    However, gridSchedule will be blank. Now if I use a message box after frmSchedule opens, gridSchedule will be filled after I click ok.
    I tried datSchedule.Refresh but that did nothing either. At the moment my code is
    VB Code:
    1. stSQL = "DELETE * FROM TempSchedule"
    2. cnnAsset.Execute stSQL
    3. stSQL = "INSERT INTO TempSchedule SELECT Schedule.* From Schedule " & _
    4.     "WHERE Schedule.Sch_AssetCode = '" & stAssetCode & "'"
    5. cnnAsset.Execute stSQL, lAffected
    6.    
    7. frmSchedule.lTotalSchedules = lAffected

    Then in the frmSchedule Load event
    VB Code:
    1. ' Now wait until the schedule data loads
    2. While lCountSchedules < lTotalSchedules        
    3.         lCountSchedules = Me.datSchedule.Recordset.RecordCount
    4.         Me.datSchedule.Refresh
    5. Wend

    Surely theres a better way!?

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: ADO Refresh

    Try....

    VB Code:
    1. datSchedule.Recordset.CursorLocation=adUseClient
    2. datSchedule.Recordset.Requery
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: ADO Refresh

    Sounds like you are deleting the records and adding them. They are there but your app beats them getting there and returns nothing.

    This has been noted already, you need to flush the cache with RDO.

    I'll edit with a link to a (possibly) related post...

    Edit:
    Another Thread with links

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    Re: ADO Refresh

    That code didn't work. I get
    3705: Operation is not allowed when the object is open.
    when I try the line
    datSchedule.Recordset.CursorLocation=adUseClient

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