Name
CommandTimeout (Command, Connection Objects) —
Obj
.CommandTimeout (=lngNumSeconds)
Synopsis
Sets the maximum amount of time (in seconds) that ADO will wait for the results of a command to execute before raising an error. The default for this Long value is 30 seconds.
Parameters
-
Obj
A reference to a Command or Connection object
-
lngNumSeconds
The number of seconds ADO will wait for the results of a command before raising an error
Example
The following example demonstrates how to use the CommandTimeout property to increase the amount of time ADO will wait for the results of a stored procedure call before raising an error.
<%@ LANGUAGE="VBSCRIPT" %> <% Response.Buffer = True %> <HTML> <HEAD> <TITLE>ADO Examples</TITLE> </HEAD> <BODY> <% ' Include ADOVBS.INC so we can use the ADO constants. %> <!-- #include virtual = "/bc_SSIncludes/adovbs.inc" --> <% ' Instantiate an ADO Connection object. Set objDBConn = Server.CreateObject("ADODB.Connection") ' Construct the connection string for the Connection object. strConn = _ "driver={MyDBType};;uid=sa;pwd=;database=SalesDB" ' Using the connection string, open the connection. objDBConn.Open strConn ' Create stored procedure command object. Set objSPCmd = Server.CreateObject("ADODB.Command") ' Set the active connection equal to the current ' Connection object. Set objSPCmd.ActiveConnection = objDBConn ' Set the Command object type to stored procedure. objSPCmd.CommandType = adCmdStoredProc ' Set the parameter values. lngHighPrice = 70000 datFirstDate ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.