Microsoft KB Archive/247380

= How To Simulate Long-Running SQL Calls from ASP =

Article ID: 247380

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft Data Access Components 1.5
 * Microsoft Data Access Components 2.0
 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.6

-



This article was previously published under Q247380



SUMMARY
This articles demonstrates how to simulate long-running stored procedures from Active Server Pages (ASP) pages. You can use this sample to test connection timeouts and long-running queries.



MORE INFORMATION
  In a blank ASP file, copy the following code: <%   Dim cnn, cmd, pa        Set cnn = server.createobject("ADODB.Connection") set cmd = server.createobject("ADODB.Command")

'This assumes you have already created a PUBS DSN cnn.ConnectionString = "dsn=pubs" cnn.Open

'TestDelay is the name of the Stored Procedure cmd.CommandText = "{? = Call TestDelay (?) }"

Set cmd.ActiveConnection = cnn cmd.parameters.refresh 'Setting the delay to 5 seconds, the format is HH:MM:SS cmd(1) = "0:00:05" response.write Now & "" response.flush

set rs = cmd.Execute

response.write rs(0)

Set cmd.ActiveConnection = Nothing Set cmd = nothing set cnn = nothing set rs = nothing %>                     Create this stored procedure in your PUBS database: CREATE PROC TestDelay @@DelayLength CHAR(9) AS BEGIN WAITFOR DELAY @@DelayLength SELECT GetDate END  Run and test your ASP file.

Keywords: kbhowto kbsqlprog KB247380

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.