The timeout property assignment in the below is ignored.
I expected the code to stop executing when it runs the query, which
takes 1 min. in the SQL Query window.
I am setting the timeout to 1 (which should be 1 second, right?)
And yet, this code executes 'til the Response.End().

function   executeQuery()
{
     var rs = Server.CreateObject("ADODB.Recordset");

     rs.CursorLocation = adUseClient;
     var cmd = Server.CreateObject("ADODB.Command");

     cmd.ActiveConnection = oConn;
     cmd.CommandText = "SELECT * FROM [someTable]";
     cmd.CommandType = adCmdText;
     cmd.CommandTimeout = 1;    //This is supposed to be one second.

     try
    {
              rs = cmd.Execute();
              i = 0;
              while(i < 10)
               //Note: there are 30K records in my table…I don’t
               // want to response.write ALL of them! I just want to
make sure there is a
               //recordset…
              {
                   Response.Write(rs("ID").value);
                  rs.MoveNext();
                  i++;
              }
     }
     catch(e)
     {
           Response.Write(e.message);
     }
     finally
     {
           if(rs.State == adStateOpen)
                 {
                       rs.Close;
                  }

                 rs= null;
     }

Response.End();

Reply via email to