I've written a small
VB application that runs a SQL Server stored procedure via an ADO connection. The app is called from a Windows program. The procedure can take a minute to run, so I've increased the timeout value of the ADO connection above the default 30 seconds. I want to make users aware that the procedure is running 'in the background' and have tried adding a 'WAIT' splash screen, and changing the mouse pointer to an hourglass so that users can see that something is happening and don't start clicking frantically.
The problem is that my program appears to wait while the procedure runs. My splash screen will only display as a 'ghost screen' with a faint border, and is drawn fully once the procedure is complete. The mouse pointer briefly changes to an hourglass, but reverts to a standard pointer while the procedure runs.
Is this a common pitfall when executing database procedures with an ADO connection? How can I provide feedback to users while the stored procedure runs?
The code approximates to this currently:
Dim objADOdatasource As ADODB.Connection
Dim comADOdatasource As ADODB.Command
.....
.....
objADOdatasource.CommandTimeout > 30 seconds
comADOdatasource.CommandTimeout > 30 seconds
With comADOdatasource
.CommandText = cp_a_stored_procedure
.CommandType = adCmdStoredProc 'Type : stored procedure
.ActiveConnection = objADOdatasource.ConnectionString
End With
display splash screen
mouse pointer = hourglass
comADOdatasource.Execute 'this is where the procedure is run
hide splash screen
mouse pointer = normal
...if return value is not success etc.