BigDaddyO

How to prevent windows from seeing script as (Not Responding)

6 posts in this topic

I have a script I put together for some end users to retrieve records from a database to use for their tests.  There are about 12 queries I run to ensure I get Valid records but 3 of them are rather long running, about 5 minutes each.  so when it gets to these queries after a few minutes the GUI freezes and shows (Not Responding).

It always recovers but the (Not Responding) is rather alarming for the end users and it also seems to halt the fancy Animated GIF I have which was supposed to show the query was still running.

Is there something I can maybe add to AdlibRegister to fool windows into thinking it's still working?

 

Thanks for any ideas you might be able to offer.

Mike

 


Share this post


Link to post
Share on other sites



It hangs right after $RS.Open($sSQL, $Conn) while the query is running.  Once data starts coming in, the UI recovers and moves on to the next one.

 

Here is one of the long running functions.  I chopped the Query part out.

Func _Query_UserIDs($Conn, $iRecords)

    $sSQL = 'Select DISTINCT Top ' & $iRecords & ' Big Query that works but takes a while'

    $RS = ObjCreate("ADODB.Recordset")              ;Create a new recordset to hold this modules RefID's
    $RS.CursorType = 3                              ;Type of connection 3 = get data at time of query, all changes from others while connected will be ignored.
    $RS.Open($sSQL,$Conn)                           ;Perform the SQL Query on the connected Database

    ;Start working through the records returned
    if $RS.EOF then

        Return SetError(1, 1, 0)                    ;Error, no records were returned.

    else

        $RS.MoveFirst
        $iRecordCount = $RS.RecordCount

        With $RS
            If .RecordCount Then

                While Not .EOF


                    $sOutputValue &= @CRLF & "ModuleName|" & StringStripWS(.Fields("RefID").Value, 3)
                    .movenext

                WEnd

            EndIf
        EndWith

    Endif

    $RS.close

    Return $iRecordCount

EndFunc ;_Query_UserIDs

 


Share this post


Link to post
Share on other sites

Ok, so you created your own SQL request with a com object.

The only "easy" solution I can think of is to re-shell your own script to perform the sql statement and in the mean time monitor the newly shelled script instance in the main script. Look at AutoI3Wrapper that does something similar for a different purpose.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I was afraid you were going to say something like that.

I'll take a look at the Wrapper to see about doing something similar.

 

Thank you very much.

Mike


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now