|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ADO connection
One of my ADO queries takes more than 30 seconds to execute and I want to use a progress bar to show the query is still progressing. Can I use the Connection.StillExecuting
statement to work out whether the query is still connecting or executing? |
|
#2
|
|||
|
|||
|
It's not the best way!
U Can use while statement and a timeout function to judge Connection.state. This is the timeout function: Public Function TimeToQuit(TimeToWait As Long) As Long 'PURPOSE: Returns a TimeOut value, in metric 'Seconds from Midnight (i.e., return value of Timer function) 'taking into account that Midnight may occur within the elapsed time 'PARAMETER: TimeToWait: Number of Seconds to Wait 'RETURN VALUE: When to TimeOut, in Seconds From Midnight 'EXAMPLE: Implements a 30 second timeout before giving 'up on a winsock Connection 'Dim lWaitUntil as Long 'lWaitUntil = TimeToQuit(30) 'Winsock1.Connect 'Do Until Winsock1.State = sckConnected or Timer > _ ' lWaitUntil ' DoEvents 'Loop 'If Winsock1.State = sckConnected Then ' MsgBox "Connection Successful" 'Else ' MsgBox "Connection TimedOut 'End If '************************************************************* Dim lStart As Long Dim lTimeToQuit As Long Dim lTimeToWait As Long lStart = Timer lTimeToWait = TimeToWait If lStart + TimeToWait < 86400 Then lTimeToQuit = lStart + lTimeToWait Else lTimeToQuit = (lStart - 86400) + TimeToWait End If TimeToQuit = lTimeToQuit End Function |
|
#3
|
|||
|
|||
|
What a detailed response! Thanks so much, that was really helpful!
|
|
#4
|
|||
|
|||
|
It's the honor of all Developers !
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > ADO connection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|