Advanced COM Success
Success read-only property

Indicates the success of the last Start or Execute operation after it has been completed. The value is Boolean - True means success, False means an error has been occurred and you can check LastError property.


variable = object.Success 


Set thread = Server.CreateObject("newObjects.utilctls.COMScriptThread")
' load/generate the script source code in the myscript variable
' and start the thread
If thread.Start("VBScript", myscript) Then
  ' start successful
  ' We do something else here ....
  ' and finally check if the thread completed its work
  If thread.Wait(30000) ' Waitng up to 30 seconds
    ' completed
    If thread.success Then
      ' Successful
      ' Read the results and do whatever we need with them
      ' .......
      ' Error
      Response.Write thread.LastError
      ' Stop the thread as it has failed
    End If
    ' The operation is not complete yet
    ' Here we can tell the user to check later - for example
    ' by requesting another page where the Wait is called again
    ' Preserve the thread in the Session
    Set Session("mythread) = thread
    ' and tell the user
    Response.Write "<A HREF=""otherpage.asp"">Please check later</A>"
  End If
  ' Cannot start - may be a compilation error for example
  Response.Write thread.LastError
End If


Note that the value should be checked after the completion of the operation. Therefore most often you should refer to it after a call to the Wait method or the Busy property. Before that (if Start or Execute operation is in progress) the value cannot be trusted to mean anything. 

Applies to: COMScriptThread object

newObjects Copyright 2001-2006 newObjects [ ]