Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asynchronous Stored Procedure Call - Issues!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm using vbScript to call a stored procedure, which takes several hours to complete. If I use cmd.Execute synchronously, the Web browser obviously times out - waiting for the stored procedure to return control to the script. I need to do this asynchronously, but I'm not able to come up with the right combination of option constants that will A) successfully run the stored procedure, and B) restore control to the browser. A snippit of my code (which accomplishes B but not A) is below - thanks in advance for any assistance.

Set cmd = Server.CreateObject("ADODB.Command")
With cmd
Set .ActiveConnection = cn
.CommandText = "gd.GET_DEPLETIONS"
.CommandType = adCmdStoredProc
.Execute , , adAsyncExecute + adExecuteNoRecords
End With
 
You'll want to use the recordset object to execute the proc. If you declare your recordset object withevents, you'll be able to get progress events.
Here's a code snippet to get you going:

cmd.CommandType = adCmdStoredProc
cmd.CommandText = "gd.GET_DEPLETIONS"


With rsRecordset
.CursorLocation = adUseClient
.Open cmd, , adOpenStatic, adLockBatchOptimistic, adCmdStoredProc + adAsyncExecute
End With

Do While rsRecordset.State = adStateExecuting
doevents
loop

nick bulka

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top