CancelUpdate 方法范例 (VBScript)

如要测试该范例,请剪切该代码并粘贴到规范的 HTML 文档的 <Body> 和 </Body> 标记之间,将其命名为 ADCapi6.asp。ASP 脚本将标识服务器。

<Center><H2>RDS API Code Examples</H2>
<HR><H3>Remote Data Service SubmitChanges and CancelUpdate Methods</H3><!-- 在设计时设置的带有参数的 RDS.DataControl   -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
   ID=ADC>
   <PARAM NAME="SQL" VALUE="Select * from Employee for browse">
   <PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
   <PARAM NAME="CONNECT" VALUE="dsn=ADCDemo;UID=ADCDemo;PWD=ADCDemo;">
</OBJECT><Object classid="clsid:AC05DC80-7DF1-11d0-839E-00A024A94B3A"
   CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/MSADC/Samples/Sheridan.cab"
   ID=GRID1 
      datasrc=#ADC
      HEIGHT=125 
      WIDTH=495>
   <PARAM NAME="AllowAddNew" VALUE="TRUE">
   <PARAM NAME="AllowDelete" VALUE="TRUE">
   <PARAM NAME="AllowUpdate" VALUE="TRUE">
   <PARAM NAME="Caption" VALUE="Remote Data Service Run Time">
</OBJECT>
<HR>
<INPUT TYPE=BUTTON NAME="SubmitChange" VALUE="Submit-Changes"><INPUT TYPE=BUTTON NAME="CancelChange" VALUE="Cancel-Update"><BR>
<H4>Add a new person or alter a current entry on the grid. Move off that Row. <BR>
Submit the Changes to your DBMS or cancel the updates. </H4>
</Center>
<Script Language="VBScript">
<!--
' 在运行时设置 RDS.DataControl 的参数。
Sub SubmitChange_OnClick
   ADC.SubmitChanges   
   ADC.Refresh
End SubSub CancelUpdate_OnClick
   ADC.CancelUpdate
End Sub
-->
</Script>
www.holmesian.org