FIX: CommandTimout Property Problem with Connection Object (175264)
The information in this article applies to:
- Microsoft Active Server Pages
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- Microsoft Data Access Components 2.5
This article was previously published under Q175264 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 = 0
MyConn.CommandTimeout = 0 ' *** THIS HAS
*** NO EFFECT BECAUSE OF THE BUG ***
MyConn.Open ConStr, UserId, PassWord
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 ***
NOTE: The CommandTimeout property on an ADO connection object has no effect on the CommandTimeout property setting of the command object on the same connection. Essentially, the command object's CommandTimeout property does not inherit the value of the connection object's CommandTimeout value.
In order for cmdTemp.CommandTimeout = 0 to work properly, you must use the command object to execute the query.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in MDAC 2.6. REFERENCES
For the latest Knowledge Base articles and other support information on
Visual InterDev and Active Server Pages, see the following page on the
Microsoft Technical Support site:
Modification Type: | Major | Last Reviewed: | 5/2/2006 |
---|
Keywords: | kbADO260fix kbASPObj kbbug kbCodeSnippet kbDatabase kbfix kbMDAC260fix kbMDACNoSweep KB175264 |
---|
|