The following code fragment shows how to use the SubmitChanges method with an RDS.DataControl object.
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=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">
<!--
' Set parameters of RDS.DataControl at Run Time
Sub SubmitChange_OnClick
   ADC.SubmitChanges   
   ADC.Refresh
End Sub
Sub CancelUpdate_OnClick
   ADC.CancelUpdate
End Sub
-->
</Script>
The following code fragment shows how to use the SubmitChanges method with an RDSServer.DataFactory object. You may want to submit changes to the DRSServer.DataFactory if you are working on a Visual Basic project where the RDS.DataControl isn't used. To create this project, open a Visual Basic form and place on it a List box (List1), two Text boxes (txtConnect and txtGetRecordset), and two Command buttons (cmdGetRecordset and cmdSubmitChanges).
Dim ads As Object ' RDS.DataSpace object Dim adf As Object ' RDSServer.DataFactory object Private Sub UserDocument_Initialize() Call Form_Load End Sub Private Sub Form_Load() txtConnect.Text = "Dsn=pubs;Uid=sa;Pwd=;" txtGetRecordset.Text = "Select au_lname from authors" End Sub Private Sub cmdGetRecordset_Click() Dim Server As String Server = txtServer.Text ' Create RDS.DataSpace using CreateObject Method of RDS.DataSpace Set ads = CreateObject("RDS.DataSpace") Set adf = ads.CreateObject("RDSServer.DataFactory", Server) ' Populate ListBox with Recordset MousePointer = vbHourglass Dim objADORs As Object Set objADORs = adf.Query(CStr(txtConnect.Text), CStr(txtGetRecordset.Text)) List1.Clear While Not objADORs.EOF List1.AddItem objADORs(0).Value objADORs.MoveNext Wend MousePointer = vbNormal End Sub Sub cmdSubmitChanges_OnClickadf.SubmitChanges " Dsn=pubs;Uid=sa;Pwd=;",_objADORsEnd Sub