Results 1 to 8 of 8

Thread: Waiting for an ADO Comand to complete

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476

    Waiting for an ADO Comand to complete

    Hi team

    I have an ADO command that writes across a slow network.
    Later in the program I have to read that data. But sometimes the data is not there when I go to read it. If I pause execution manually and then continue, it's OK.

    How can make execution wait until the command has completed?

    Thanks

    FW

  2. #2
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245
    Check the State property of your command object. IE:

    Do While CMD.State = adStateExecuting Or CMD.State = adStateFetching
    ' Pass time... perhaps DoEvents.
    Loop

    ' Read the data here.
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    Thanks Sheppe

  4. #4
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245
    NP.
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

  5. #5
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi Sheppe

    I tried this before but it never worked with me, hehe

    I have in a Form a rsWhatever.Sort and after this is done the sortorder should be correct. If I use .State as waiting-loop I never get the sortorder, but if i have after the .Sort command a line with an Msgbox then it works.

    any ideas to that?

    .... strange .....

    nice greetings
    Franky

  6. #6
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245

    Re: Hi Sheppe

    Originally posted by Franky
    I tried this before but it never worked with me, hehe

    I have in a Form a rsWhatever.Sort and after this is done the sortorder should be correct. If I use .State as waiting-loop I never get the sortorder, but if i have after the .Sort command a line with an Msgbox then it works.

    any ideas to that?

    .... strange .....

    nice greetings
    Franky
    Sort has nothing to do with DB activity; it is a function of the recordset object. Typically, it shouldn't return until it's done sorting.
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

  7. #7
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Come on Sheppe

    ... don't split hairs ......

    You know anyway what I mean. It is of course a recordset-action.

    (I will ask next time my solicitor to check that I used the correct words, hehe)

    But still the problem is as I said. It looks like that it finish this first before it resume with the next programline, but it isn't so.

    nice greetings
    Franky

  8. #8
    Addicted Member Sheppe's Avatar
    Join Date
    Sep 2002
    Location
    Kelowna, BC
    Posts
    245

    Re: Come on Sheppe

    Originally posted by Franky
    ... don't split hairs ......

    You know anyway what I mean. It is of course a recordset-action.

    (I will ask next time my solicitor to check that I used the correct words, hehe)

    But still the problem is as I said. It looks like that it finish this first before it resume with the next programline, but it isn't so.

    nice greetings
    Franky
    I'm not splitting hairs, I'm making a statement. I also told you what behaviour to expect; the Sort method should not return until it is done sorting. Perhaps I'm not understanding what it is you're asking for.
    [vbcode]
    On Error Goto Hell
    [/vbcode]
    Sheppe Pharis, MCSD
    Check out http://www.vb-faq.com
    Click here for access to the free Code-Express source code and component sharing network for VB6
    Want a better way to skin your .NET applications? Click here!

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