title: ADODB CommandTimeout executing stored procedure in classic asp
body: <p>I have a problem in a very old project. There is a timeout exception during a long database process.  </p>
  
  <p>Here is initial code</p>
  
  <pre><code>Set objCmd = Server.CreateObject("ADODB.Command")
  objCmd.ActiveConnection = Common_CnxStr
  objCmd.CommandText = "Db.SP_Name"
  objCmd.CommandType = adCmdStoredProc
  /*some query parameters are added here*/  
  objCmd.Execute
  </code></pre>
  
  <p>This runs for 90 seconds then fails with timeout exception. How can I increase the timeout to, for example, 5 minutes. </p>
  
  <p>I tried to extend the timeout by adding to my code the line objCmd.CommandTimeout</p>
  
  <pre><code>Set objCmd = Server.CreateObject("ADODB.Command")
  objCmd.CommandTimeout = 300 
  objCmd.ActiveConnection = Common_CnxStr
  objCmd.CommandText = "Db.SP_Name"
  objCmd.CommandType = adCmdStoredProc
  /*some query parameters are added here*/  
  objCmd.Execute
  </code></pre>
  
  <p>But this does not work and I still have an exception after 90 seconds. I even tried to do like this </p>
  
  <pre><code>Server.ScriptTimeout = 300
  Set objCmd = Server.CreateObject("ADODB.Command")
  objCmd.CommandTimeout = 300 
  objCmd.ActiveConnection = Common_CnxStr
  objCmd.ActiveConnection.CommandTimeout = 300
  objCmd.CommandText = "Db.SP_Name"
  objCmd.CommandType = adCmdStoredProc
  /*some query parameters are added here*/  
  objCmd.Execute
  </code></pre>
  
  <p>But this did not change anything. Please help. </p>