Share via


Cancel Method Example (VBScript)

The following example shows how to read the Cancel method at run time. Cut and paste the following code to Notepad or another text editor and save it as CancelVBS.asp. You can view the result in any client browser.

<!-- BeginCancelVBS -->
<Script Language="VBScript">
<!--
Sub cmdCancelAsync_OnClick
   ' Terminates currently running AsyncExecute,
   ' ReadyState property set to adcReadyStateLoaded,
   ' Recordset set to Nothing
  ADC.Cancel
End Sub

Sub cmdRefreshTable_OnClick
   ADC.Refresh
End Sub
-->
</Script>

<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="ADC">
.
   <PARAM NAME="SQL" VALUE="Select FirstName, LastName from Employees">
   <PARAM NAME="CONNECT" VALUE="Provider='sqloledb';Integrated Security='SSPI';Initial Catalog='Northwind'">
   <PARAM NAME="Server" VALUE="https://<%=Request.ServerVariables("SERVER_NAME")%>">
.
</OBJECT>

<TABLE DATASRC=#ADC>
<TBODY>
  <TR>
    <TD><SPAN DATAFLD="FirstName"></SPAN></TD>
    <TD><SPAN DATAFLD="LastName"></SPAN></TD>
  </TR>
</TBODY>
</TABLE>

<FORM>
<INPUT type="button" value="Refresh" id=cmdRefreshTable name=cmdRefreshTable>
<INPUT type="button" value="Cancel" id=cmdCancelAsync name=cmdCancelAsync>
</FORM>
<!-- EndCancelVBS -->

See Also

Cancel Method