MDAC 2.5 SDK - ADO


 

CancelUpdate Method Example (VBScript)

See Also

To test this example, cut and paste this code between the <Body></Body> tags in a normal HTML document and name it ADCapi6.asp. ASP script will identify your server.

<Center>
<H2>RDS API Code Examples</H2>
<HR>
<H3>Remote Data Service SubmitChanges and CancelUpdate Methods</H3>

<!-- RDS.DataControl with parameters set at design time -->
<OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33"
   ID=RDS HEIGHT=1 WIDTH=1>
   <PARAM NAME="SQL" VALUE="Select * from Employee">
   <PARAM NAME="SERVER" VALUE="http://<%=Request.ServerVariables("SERVER_NAME")%>">
   <PARAM NAME="CONNECT" VALUE="Provider=SQLOLEDB;User Id=rdsdemo;Password=rdsdemo;Initial Catalog=AddrBookDB">
</OBJECT>

<TABLE DATASRC="#ADC">
<THEAD>
<TR ID="ColHeaders">
   <TH>ID</TH>
   <TH>FName</TH>
   <TH>LName</TH>
   <TH>Name</TH>
   <TH>Title</TH>
   <TH>Type</TH>
   <TH>Email</TH>
   <TH>MgrEmail</TH>
   <TH>Bldg</TH>
   <TH>Rm</TH>
   <TH>Phone</TH>
</TR>
</THEAD>

<TBODY>
<TR>
   <TD> <INPUT DATAFLD="ID" size=4> </TD>
   <TD> <INPUT DATAFLD="FirstName" size=10> </TD>
   <TD> <INPUT DATAFLD="LastName" size=10> </TD>
   <TD> <INPUT DATAFLD="Name" size=15> </TD>
   <TD> <INPUT DATAFLD="Title" size=20> </TD>
   <TD> <INPUT DATAFLD="Type" size=10> </TD>
   <TD> <INPUT DATAFLD="Email" size=10> </TD>
   <TD> <INPUT DATAFLD="ManagerEmail" size=10> </TD>
   <TD> <INPUT DATAFLD="Building" size=3> </TD>
   <TD> <INPUT DATAFLD="Room" size=5> </TD>
   <TD> <INPUT DATAFLD="Phone" size=8> </TD>
</TR>
</TBODY>
</TABLE>


<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">
<!--
' Set parameters of RDS.DataControl at Run Time
Sub SubmitChange_OnClick
   RDS.SubmitChanges   
   RDS.Refresh
End Sub

Sub CancelUpdate_OnClick
   RDS.CancelUpdate
End Sub
-->
</Script>