BUG: CommandTimout Property Problem with Connection Object

ID: Q175264


The information in this article applies to:


SYMPTOMS

The Connection object of the ActiveX Data Objects supports the CommandTimeout property. This property is documented to support a value of 0, which provides for an infinite timeout. This functionality is not available in ActiveX Data Objects 1.0.


RESOLUTION

The CommandTimeout property functions properly for all values other than 0. If you wish an infinite timeout, you will need to use this parameter in conjunction with the Command object instead. The following example demonstrates how to set the Command object's timeout:


   Set MyConn = Server.CreateObject("ADODB.Connection")
   MyConn.ConnectionTimeout = Session("MyConn_ConnectionTimeout")
   MyConn.CommandTimeout = Session("MyConn_CommandTimeout") ' *** THIS HAS
    *** NO EFFECT BECAUSE OF THE BUG ***
   MyConn.Open Session("MyConn_ConnectionString"),
    Session("MyConn_RuntimeUserName"), Session("MyConn_RuntimePassword")
   Set cmdTemp = Server.CreateObject("ADODB.Command")

   ' *** T H I S   L I N E   W A S   A D D E D ***
   cmdTemp.CommandTimeout = 0 ' *** SETTING IT TO ZERO CAUSES IT TO WAIT
    FOREVER *** 


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The following code attempts to set the timeout to 0. When set to this value, the connection object should provide for an indefinite amount of time before timing out. It does not.


   <%
   Set cn = Server.CreateObject("ADODB.Connection")
   cn.CommandTimeout = 0
   cn.Open "datasourcename", "userid", "password"
   cn.Execute("SQL statement that would cause a timeout")
   %> 


REFERENCES

For the latest Knowledge Base artices and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:

http://support.microsoft.com/support/vinterdev/

Additional query words:


Keywords          : kbADO kbASPObj kbGrpASP 
Version           : 
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: May 27, 1999