reformed
reformed

Reputation: 4810

Is it necessary to specify CommandTimeout for both ADODB.Connection and ADODB.Command objects?

Is it necessary to specify the CommandTimeout property for the ADODB Connection and Command objects in VBScript? Or does the Command object inherit the property value from the Connection object?

Set ADODBConnection = Server.CreateObject("ADODB.Connection")
Set ADODBCommand = Server.CreateObject("ADODB.Command")

ADODBConnection.CommandTimeout = 90

ADODBCommand.ActiveConnection = ADODBConnection

ADODBCommand.CommandTimeout = 90 '<-- is this necessary?
...

Upvotes: 1

Views: 4741

Answers (1)

Bret
Bret

Reputation: 376

Short answer to your question, yes, it is necessary if you want to specify the ADODBCommand.CommandTimeout to a value other than its default setting (30, I believe). From MSDN:

The CommandTimeout setting on a Connection object has no effect on the CommandTimeout setting on a Command object on the same Connection; that is, the Command object's CommandTimeout property does not inherit the value of the Connection object's CommandTimeout value.

Source: http://msdn.microsoft.com/en-us/library/windows/desktop/ms678265%28v=vs.85%29.aspx

Upvotes: 3

Related Questions